Yes, this is the Oauth 2.0 token that is required here,
you can use this for this.
n you cannot provide your own token, as it may change in relation to the user.
private void getGoogleOAuthTokenAndLogin() { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); // Log.e("SahajLOG", "Login PREF ISSSSSSSS ONCREATE "+prefs.getBoolean("AuthByGplus", AuthByGplus)); if (!prefs.getBoolean("AuthByGplus", AuthByGplus)) { AsyncTask<Void, Void, String> task = new AsyncTask<Void, Void, String>() { String errorMessage = null; @Override protected String doInBackground(Void... params) { String token = null; try { String scope = String.format("oauth2:%s", Scopes.PLUS_LOGIN); token = GoogleAuthUtil.getToken(MainActivity.this, Plus.AccountApi.getAccountName(mGoogleApiClient), scope); } catch (IOException transientEx) { /* Network or server error */ Log.e("SahajLOG", "Error authenticating with Google: " + transientEx); errorMessage = "Network error: " + transientEx.getMessage(); } catch (UserRecoverableAuthException e) { Log.w("SahajLOG", "Recoverable Google OAuth error: " + e.toString()); /* We probably need to ask for permissions, so start the intent if there is none pending */ if (!mIntentInProgress) { mIntentInProgress = true; Intent recover = e.getIntent(); startActivityForResult(recover, MainActivity.GOOGLE_SIGIN); } } catch (GoogleAuthException authEx) { /* The call is not ever expected to succeed assuming you have already verified that * Google Play services is installed. */ Log.e("SahajLOG", "Error authenticating with Google: " + authEx.getMessage(), authEx); errorMessage = "Error authenticating with Google: " + authEx.getMessage(); } return token; } @Override protected void onPostExecute(String token) { mGoogleLoginClicked = false; Intent resultIntent = new Intent(); if (token != null) { Log.e("SahajLOG", "TOKEN IS " + token); // firebaseAuthWithGoogle(token); //onGoogleLoginWithToken(token); resultIntent.putExtra("oauth_token", token); } else if (errorMessage != null) { resultIntent.putExtra("error", errorMessage); } setResult(MainActivity.GOOGLE_SIGIN, resultIntent); finish(); } }; task.execute(); } Log.e("SahajLOG", "oAuthCalled"); /* Get OAuth token in Background */ }
source share