我想在我的应用程序中集成 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”