Play 框架附加 #_=_ 以通过 OAuth2 在 Facebook 身份验证后重定向? [英] Play Framework appending #_=_ to redirect after Facebook auth via OAuth2?
问题描述
在使用 Play 框架调用 OAuth2::retrieveAccessToken() 后,我正在做一个简单的重定向.我在 URL 后面附加了一些我从未放过的有趣字符,因此最终结果如下所示:
I'm doing a simple redirect after calling OAuth2::retrieveAccessToken() with Play Framework. I'm having funny characters appended to the URL that I never put there, so the end result looks as follows:
#_=_ 到底从何而来?这是我在路由文件中的路由定义:
Where on earth does the #_=_ come from? Here's my route definition from the routes file:
GET/Application.index
GET / Application.index
这是处理 Facebook 身份验证的控制器的代码片段:
Here's the code snippet of the controller dealing with the Facebook authentication:
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());
}
根据此页面,Facebook 最近更改了他们的 API 以包含 = 如果 request_uri 为空,问题是...我的 request_uri 已明确设置?
According to this page, Facebook changed their API recently to include the = if request_uri is empty, the problem is...my request_uri has been explicitly set?
推荐答案
这是在安全更新后添加的.
This was added after a security update.
来自 Facebook 开发者博客:
会话重定向行为的变化
本周,我们开始向 redirect_uri 添加片段 #_=_
当此字段留空时.请确保您的应用程序可以处理这种行为.
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.
这篇关于Play 框架附加 #_=_ 以通过 OAuth2 在 Facebook 身份验证后重定向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!