0

I am using the following code to get Authsubtoken from my android application; following is the code:

 GoogleAuthUtil.getToken(myCtx,  "mymail@gmail.com","oauth2:https://www.googleapis.com/auth/userinfo.profile")

With this code, I get the following exception:

com.google.android.gms.auth.UserRecoverableAuthException: NeedPermission

How to overcome this exception?

Any help is appreciated.

user1400538
  • 855
  • 5
  • 24
  • 42
  • 1
    Take a look [here](http://developer.android.com/reference/com/google/android/gms/auth/GoogleAuthUtil.html) – tttony Apr 15 '13 at 12:35
  • How to get "MY_ACTIVITYS_AUTH_REQUEST_CODE" in the link you gave – user1400538 Apr 15 '13 at 16:47
  • 1
    It's just an integer variable, you can give any number that later you have to use with `onActivityResult()` see that example on that link – tttony Apr 15 '13 at 17:34
  • if (resultCode == RESULT_OK) { getAndUseAuthTokenInAsyncTask(); } -- do I eed to set the result as well? – user1400538 Apr 15 '13 at 17:52

1 Answers1

1

Using this exception

...
} catch (UserRecoverableAuthIOException e) {
   startActivityForResult(e.getIntent(), REQUEST_AUTHORIZATION);
}
... 

check out more here

https://stackoverflow.com/a/14386248/760489

https://stackoverflow.com/a/15142977/760489

Community
  • 1
  • 1
Pratik
  • 30,639
  • 18
  • 84
  • 159
  • How can I get "REQUEST_AUTHORIZATION" . If you check the first link you provided, I have already added a comment in the answer, stating the same. – user1400538 Apr 15 '13 at 16:46