来自Android应用程序的Gmail accessToken和refreshToken
我有一个后端应用程序,它使用gmail访问令牌和刷新令牌访问用户的gmail帐户来自Android应用程序的Gmail accessToken和refreshToken,android,google-oauth,Android,Google Oauth,我有一个后端应用程序,它使用gmail访问令牌和刷新令牌访问用户的gmail帐户 TokenResponse tokenResponse = new TokenResponse(); tokenResponse.setAccessToken(accessToken); tokenResponse.setRefreshToken(refreshToken); Credential credential = new Credential.Builder(BearerT
TokenResponse tokenResponse = new TokenResponse();
tokenResponse.setAccessToken(accessToken);
tokenResponse.setRefreshToken(refreshToken);
Credential credential = new Credential.Builder(BearerToken.authorizationHeaderAccessMethod()).setTransport(
HTTP_TRANSPORT)
.setJsonFactory(JSON_FACTORY)
.setTokenServerUrl(
new GenericUrl("https://accounts.google.com/o/oauth2/token"))
.setClientAuthentication(new BasicAuthentication("abc.apps.googleusercontent.com",
"xyz"))
.build()
.setFromTokenResponse(tokenResponse);
在前端,我有一个android应用程序,可以访问authorizationToken:
mCredential = GoogleAccountCredential.usingOAuth2(
getApplicationContext(),SCOPES)
.setBackOff(new ExponentialBackOff())
.setSelectedAccountName( (String)SharedPrefUtils.getValue(SharedPrefUtils.PREF_ACCOUNT_NAME,SharedPrefUtils.DATA_TYPE_STRING));
但是如何从中获取accessToken和refreshToken以发送到后端
应用程序?
有人能帮忙吗?请完成以下步骤:
请看一节:Android应用程序获得web后端的脱机访问