2015-10-31 93 views
0

我有一个后端应用程序,它使用Gmail访问令牌和刷新令牌访问用户的Gmail帐户。从Android应用程序的Gmail accessToken和refreshToken

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发送到后端 应用程序? 有人可以帮忙吗?

回答

相关问题