我正在尝试使用AppAuth从基于 OAuth2 的服务器获取 AccessToken 。
在下面的代码重定向到浏览器进行登录之后
AuthorizationService service = new AuthorizationService(this,
new AppAuthConfiguration.Builder().setBrowserMatcher(blacklist).build());
service.performAuthorizationRequest(request,
PendingIntent.getActivity(this, request.hashCode(),new Intent(this,ReceiverActivity.class),0));
service.dispose();
当我在上面的代码中使用 ReceiverActivity 从浏览器返回到应用程序时,然后在:
public viod onStart(){
AuthorizationResponse response = AuthorizationResponse.fromIntent(getIntent()); //null
AuthorizationException ex = AuthorizationException.fromIntent(getIntent());// exception below
}
{"type":0,"code":9,"errorDescription":"Response state param did not match request state"}
其他:
AuthorizationRequest request = new AuthorizationRequest.Builder(
authorizationServiceConfiguration,
"clientid",
"token",
Uri.parse(CONSTANTS.REDIRECT_URL)
).setScope("crm_read")
.setAdditionalParameters(autoApprove)
.build();
显现
<activity android:name="net.openid.appauth.RedirectUriReceiverActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="${appAuthRedirectScheme}"
android:host="com.crm.crm"
android:path="/oauth2callback"/>
</intent-filter>
</activity>
那么,为什么我会收到此错误 {"type":0,"code":9,"errorDescription":"Response state param did not match request state"} 我需要在链接中设置一些内容?