2
我一直试图弄清楚这一点现在,似乎无法得到我试过的任何东西。Android oAuth刷新标记返回null
我似乎无法检索刷新令牌,它会出现为空白。
public class oaUTH extends AsyncTask<Void, Void, Void> {
protected Void doInBackground(Void... unused) {
try {
JsonFactory jsonFactory = new JacksonFactory();
HttpTransport transport = new NetHttpTransport();
CredentialStore credentialStore = new SharedPreferencesCredentialStore(prefs);
AccessTokenResponse accessTokenResponse = credentialStore.read();
GoogleAccessProtectedResource accessProtectedResource = new GoogleAccessProtectedResource(accessTokenResponse.accessToken,
transport,
jsonFactory,
OAuth2ClientCredentials.CLIENT_ID,
OAuth2ClientCredentials.CLIENT_SECRET,
accessTokenResponse.refreshToken+"&access_type=offline");
final Latitude latitude = new Latitude(transport, accessProtectedResource, jsonFactory);
latitude.apiKey=OAuth2ClientCredentials.API_KEY;
Log.i("AGENTPORTAL", "Access Token = " + accessTokenResponse.accessToken + ", Expires in = " + accessTokenResponse.expiresIn + ", Refresh Token = " + accessTokenResponse.refreshToken + ", Scope = " + accessTokenResponse.scope);
LatitudeCurrentlocationResourceJson currentLocation = latitude.currentLocation.get().execute();
String locationAsString = convertLocationToString(currentLocation);
Log.i("TAG", locationAsString);
//textView.setText(locationAsString);
} catch (Exception ex) {
ex.printStackTrace();
//textView.setText("Error occured : " + ex.getMessage());
startActivity(new Intent().setClass(getApplicationContext(),OAuthAccessTokenActivity.class));
}
这里是日志:访问令牌= ** AHES6ZTeqgwdxjll6Gb4Cf9I0_n5bO_OdgR2OR * * WLPCPzJ5xtO5M,到期时间= 3599,刷新令牌=,=范围
任何想法,刷新令牌= “”?我添加了“& access_type = offline”,但仍然没有运气。任何帮助深表感谢!
谁能帮助? –