私は自分のアプリケーションでSpring Socialを使用しようとしており、元の 'OAuth2'状態パラメータが常にアプリケーション上でnullであることをデバッグ中に気付きました。元の 'OAuth2'状態パラメータがorg.springframework.social.connect.web.ConnectSupportのnullになる原因は何ですか?
以下org.springframework.social.connect.web.ConnectSupport
ため
を参照してください春社会のソースコード:
private void verifyStateParameter(NativeWebRequest request) {
String state = request.getParameter("state");
String originalState = extractCachedOAuth2State(request);//Always null...
if (state == null || !state.equals(originalState)) {
throw new IllegalStateException("The OAuth2 'state' parameter is missing or doesn't match.");
}
}
private String extractCachedOAuth2State(WebRequest request) {
String state = (String) sessionStrategy.getAttribute(request, OAUTH2_STATE_ATTRIBUTE);
sessionStrategy.removeAttribute(request, OAUTH2_STATE_ATTRIBUTE);
return state;
}
誰が助けてくださいことはできますか?
編集:私はFacebookから戻って渡される状態パラメータを参照してください行います
Request URL:https://www.facebook.com/v2.5/dialog/oauth?client_id=414113641982912&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fconnect%2Ffacebook&scope=public_profile&state=0b7a97b5-b8d1-4f97-9b60-e3242c9c7eb9
Request Method:GET
Status Code:302
Remote Address:179.60.192.36:443
編集2:ところで、私が手例外は以下の通りです:
Exception while handling OAuth2 callback (The OAuth2 'state' parameter is missing or doesn't match.). Redirecting to facebook connection status page.
ヘッダーとカスタムセッションの両方の戦略を維持する必要がありますか?私は同じ問題に直面しています。 – gschambial