在使用 Play Framework 调用 OAuth2::retrieveAccessToken() 后,我正在做一个简单的重定向。我在 URL 后附加了有趣的字符,但我从来没有放在那里,所以最终结果如下所示:
#_=_ 究竟从何而来?这是我在路由文件中的路由定义:
GET / Application.index
这是处理 Facebook 身份验证的 Controller 的代码片段:
public static void facebookConnect() {
OAuth2 facebook = new OAuth2(
"https://graph.facebook.com/oauth/authorize",
"https://graph.facebook.com/oauth/access_token",
"2#############6",
"c##############################2"
);
if(OAuth2.isCodeResponse()) {
OAuth2.Response oauthResponse = facebook.retrieveAccessToken(facebookAuthUrl());
if(oauthResponse.error == null) {
//... Somewhere here, something is causing #_=_ to be appended to the URL?
Application.index();
}
}
facebook.retrieveVerificationCode(facebookAuthUrl());
}
编辑:
根据 this page , Facebook 最近更改了他们的 API 以包含 = 如果 request_uri 为空,问题是......我的 request_uri 是否已明确设置?
最佳答案
这是在安全更新后添加的。
Change in Session Redirect Behavior
This week, we started adding a fragment
#_=_
to the redirect_uri when this field is left blank. Please ensure that your app can handle this behavior.
关于java - Play Framework 附加 #_=_ 以在通过 OAuth2 进行 Facebook 身份验证后重定向?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7324944/