我想在我的应用中集成Uber SDK,我收到'expired_jwt'错误。
以下是我的代码:
configuration = new SessionConfiguration.Builder()
.setClientId(CLIENT_ID)
.setRedirectUri(REDIRECT_URI)
//.setServerToken(SERVER_TOKEN)
.setEnvironment(SessionConfiguration.Environment.SANDBOX)
.setScopes(Arrays.asList(Scope.ALL_TRIPS, Scope.PROFILE))
.build();
accessTokenManager = new AccessTokenManager(this);
//Use a custom button with an onClickListener to call the LoginManager directly
loginManager = new LoginManager(accessTokenManager, new UberLoginCallback(), configuration, LOGIN_REQUEST_CODE);
//登录
loginManager.login(MainActivity.this);
//然后我得到结果
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
loginManager.onActivityResult(this, requestCode, resultCode, data);
}
// UberLoginCallback类是这样的:
private class UberLoginCallback implements LoginCallback {
@Override
public void onLoginCancel() {
Toast.makeText(MainActivity.this, "Login Cancelled", Toast.LENGTH_LONG).show();
}
@Override
public void onLoginError(@NonNull AuthenticationError error) {
Toast.makeText(MainActivity.this, "Login Error : " + error.toString(), Toast.LENGTH_LONG).show();
}
@Override
public void onLoginSuccess(@NonNull AccessToken accessToken) {
Toast.makeText(MainActivity.this, "Login Success", Toast.LENGTH_LONG).show();
}
@Override
public void onAuthorizationCodeReceived(@NonNull String authorizationCode) {
Toast.makeText(MainActivity.this, "Authorization Code : " + authorizationCode, Toast.LENGTH_LONG).show();
}
}
在'onLoginError()'中我收到错误'expired_jwt'
答案 0 :(得分:1)
JWT包含响应的时间戳。我们使用30秒的验证窗口。您使用的设备/仿真器可能没有准确的系统时间。请修复时间再试一次。