title: How to properly use Google Drive Rest API?
body: <p>I have an application where I want to upload the SQLite database file to the user's google drive account. </p>
  
  <p>As Google Android API will stop working I thought to implement REST API, implementing REST API requires authentication. I am using Google Sign-in, but REST API Requires some type of access token. <strong>How to get that?</strong></p>
  
  <p>I created an account in the developer console, enabled the Drive API, plus added the Scope for drive/auth.</p>
  
  <p>I achieved the login functionality using the official documentation, <a href="https://developers.google.com/identity/sign-in/android/sign-in" rel="nofollow noreferrer">https://developers.google.com/identity/sign-in/android/sign-in</a></p>
  
  <p>Using this code I can get the email of the user as well as create a DriveService,</p>
  
  <pre><code>    GoogleSignInOptions googleSignInOptions = new 
      GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                  .requestScopes(new Scope(DriveScopes.DRIVE))
                  .requestEmail()
                  .build();
  
      googleSignInClient = GoogleSignIn.getClient(this, googleSignInOptions);
  
      Intent googleSignInIntent = googleSignInClient.getSignInIntent();
      startActivityForResult(googleSignInIntent, REQUEST_CODE_SIGN_IN);
  </code></pre>
  
  <p>In on activity result, I can get the user account, using the account I create a DriveServiceHelper</p>
  
  <pre><code>    mDriveServiceHelper = new DriveServiceHelper(getGoogleDriveService(getApplicationContext(), googleSignInAccount, "appName"));
  
  </code></pre>
  
  <p>Now the thing is when I try to create folder It shows me an error about <strong>(UserRecoverableAuthIOException),</strong></p>
  
  <p>See the code using which I create Folder</p>
  
  <pre><code>public Task&lt;GoogleDriveFileHolder&gt; createFolder(final String folderName, @Nullable final String folderId) {
          return Tasks.call(mExecutor, new Callable&lt;GoogleDriveFileHolder&gt;() {
              @Override
              public GoogleDriveFileHolder call() {
                  GoogleDriveFileHolder googleDriveFileHolder = new GoogleDriveFileHolder();
  
                  List&lt;String&gt; root;
                  if (folderId == null) {
                      root = Collections.singletonList("root");
                  } else {
  
                      root = Collections.singletonList(folderId);
                  }
                  File metadata = new File()
                          .setParents(root)
                          .setMimeType(DriveFolder.MIME_TYPE)
                          .setName(folderName);
  
                  File googleFile = null;
                  googleFile = mDriveService.files().create(metadata).execute();
                  googleDriveFileHolder.setId(googleFile.getId());
                  return googleDriveFileHolder;
              }
          });
      }
  </code></pre>
  
  <p>I tried solving the error, using various discussion threads available in StackOverflow none of them worked, can anyone guide me through this?</p>