Android中的authSubToken异常

时间:2013-04-15 12:26:40

标签: android oauth gmail

我使用以下代码从我的Android应用程序获取Authsubtoken;以下是代码:

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

使用此代码,我得到以下异常:

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

如何克服此异常?

感谢任何帮助。

1 个答案:

答案 0 :(得分:1)

使用此例外

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

在这里查看更多

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

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