java - Play Framework 附加 #_=_ 以在通过 OAuth2 进行 Facebook 身份验证后重定向?

标签 java facebook playframework oauth-2.0

在使用 Play Framework 调用 OAuth2::retrieveAccessToken() 后,我正在做一个简单的重定向。我在 URL 后附加了有趣的字符,但我从来没有放在那里,所以最终结果如下所示:

http://localhost:9000/#_=_

#_=_ 究竟从何而来?这是我在路由文件中的路由定义:

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 是否已明确设置?

最佳答案

这是在安全更新后添加的。

来自Facebook developer blog :

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/

相关文章:

java - JFace 向导的默认大小是多少?怎么知道呢?

java - JPA - 实体设计问题

html - 合适的静态 FBML 应用程序替换

php - 用 PHP 发送电子邮件到 Facebook 组邮件地址

java - 从上传的文件中获取文件扩展名

scala - 从 Play Framework 异步调用 Solr

api - 我应该使用单独的 REST 后端项目和 javascript 重型前端吗?

java - JSON 对象 - 如何获取值

android - Facebook 访问 token 始终为空

使用 HCL Domino NotesThread 时,Java 关闭钩子(Hook)被忽略(?)