[postlink]
https://the-best-way-of-life-is-islam.blogspot.com/2015/07/validation-backend-with-get-google.html
[/postlink]
I have a problem when I try get Google token in android to Balidation backend. I create Web Application Client Id (I use http://localhost in url paths), Android Client Id, and use this code:
public class GoogleOAuthTask extends AsyncTask<Void, Void, String> {
private static final String TAG = GoogleOAuthTask.class.getSimpleName();
Activity mActivity;
String mEmail;
private final static String SCOPE = "audience:server:client_id:XXXXXXXXXXXXXXXXXXXAAAAAXXXXXXXXXXX.apps.googleusercontent.com";
public GoogleOAuthTask(Activity activity, String email) {
this.mActivity = activity;
this.mEmail = name;
}
@Override
protected String doInBackground(Void... params) {
String accountName = "myRandomValidEmail@gmail.com";
Account account = new Account(accountName, GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE);
String scopes = "audience:server:client_id:XXXXXASASXXXXX.apps.googleusercontent.com"; // This is my Web Application Client Id
try {
return GoogleAuthUtil.getToken(mActivity, account, scopes);
} catch (IOException e) {
Log.e(TAG, "Error retrieving ID token.", e);
return null;
} catch (GoogleAuthException e) {
Log.e(TAG, "Error retrieving ID token.", e);
return null;
}
}
}
My problem is:
When I call GoogleAuthUtil.getToken(mActivity, account, scopes) the code no continue , i.e, method never end.
I'm waiting
More informations:
I use .android/debug.keystore to generate SHA-1 hash I use http://localhost in Javascript Origins I use http://localhost/MyWebService in Redirect URI.
Enregistrer un commentaire