facebook redirect_uri不适用于移动设备

时间:2014-12-02 09:26:22

标签: facebook facebook-graph-api authentication oauth oauth-2.0

我有一个Facebook画布应用程序,我运行相同的代码和相同的redirect_uri用于网络和移动,它在我的网络配置中没有问题但我的移动版本没有问题。我的应用程序是一个响应式应用程序,所以即使facebook配置中的URL也是相同的。

我用它来生成网址的方法

List<NameValuePair> qparams = new ArrayList<>();
            qparams.add(new BasicNameValuePair("client_id", facebookClientId));
            qparams.add(new BasicNameValuePair("redirect_uri", "https://apps.facebook.com/customdomain"));
            qparams.add(new BasicNameValuePair("client_secret", facebookClientSecret));
            qparams.add(new BasicNameValuePair("code", code));

            uri = new URIBuilder()
                    .setScheme("https")
                    .setHost("graph.facebook.com")
                    .setPath("/oauth/access_token")
                    .setParameters(qparams)
                    .build(); 

website url https://local.mydomain.com:8443/test/facebook/auth

mobile url https://local.mydomain.com:8443/test/facebook/auth

画布网址

https://local.mydomain.com:8443/test/facebook/auth/

auth urls

https://local.mydomain.com:8443/test/facebook/auth/
https://apps.facebook.com/customdomain

应用域

https://apps.facebook.com/customdomain

网站上的工作网址

https://graph.facebook.com/oauth/access_token?client_id=578152068997908&redirect_uri=https%3A%2F%2Fapps.facebook.com%2Fmydomain&client_secret=xxxx&code=AQBQ_VZlxKWqMfmC2neu8DIllor0Lrp1wvLvtSD5do3PyMfO_jxiEjcGEbZ-a0bEJbe6Ya9Noh9esXm2mgmgw0zP9OQOM-2h7VBYkruix0o7isKWwYkksFAi-i2qpUmTBcb0YxAqrn5y2aEWk8GxmhEVAgsW3GGLksNTndhZr3NYDs5Mi4GtmsjMKJbO8dTzePDrh4iSz_Qv0fmgalkDhIRmM7zsjodFPkytL4rlzG9Q4oN14qEhpBUmISnu8cAQcLvOlYACD17nFqhyq-BOVmX8PpUNRFdoHDk9KUTUv7c8PbfVGOBmWeJJKxWdZ0ncUu0

非工作移动

https://graph.facebook.com/oauth/access_token?client_id=578152068997908&redirect_uri=https%3A%2F%2Fapps.facebook.com%2Fmydomain&client_secret=xxxx&code=AQBQ_VZlxKWqMfmC2neu8DIllor0Lrp1wvLvtSD5do3PyMfO_jxiEjcGEbZ-a0bEJbe6Ya9Noh9esXm2mgmgw0zP9OQOM-2h7VBYkruix0o7isKWwYkksFAi-i2qpUmTBcb0YxAqrn5y2aEWk8GxmhEVAgsW3GGLksNTndhZr3NYDs5Mi4GtmsjMKJbO8dTzePDrh4iSz_Qv0fmgalkDhIRmM7zsjodFPkytL4rlzG9Q4oN14qEhpBUmISnu8cAQcLvOlYACD17nFqhyq-BOVmX8PpUNRFdoHDk9KUTUv7c8PbfVGOBmWeJJKxWdZ0ncUu0

响应

InternalModule.PageLoader Loaded page 'facebook/Auth' (en) in 112.543 ms
response HttpResponseProxy{HTTP/1.1 400 Bad Request [WWW-Authenticate: OAuth "Facebook Platform" "invalid_code" "Error validating verification code. Please make sure your redirect_uri is identical to the one you used in the OAuth dialog request", Facebook-API-Version: v1.0, Content-Type: text/javascript; charset=UTF-8, Pragma: no-cache, Access-Control-Allow-Origin: *, X-FB-Rev: 1514665, Cache-Control: no-store, Expires: Sat, 01 Jan 2000 00:00:00 GMT, X-FB-Debug: WpyeYYw/BIs08HkafBWcrkbU5tICVgEHTKrPBAiTzZEqjgP3OGCP8eQwNVx2lx6b0iH9GGqIrir3S4iGu7VAIw==, Date: Tue, 02 Dec 2014 09:21:50 GMT, Connection: keep-alive, Content-Length: 190]}
facebook.FacebookAuth com.mydomain.test.pages.facebook.FacebookAuth 400 HttpResponseProxy{HTTP/1.1 400 Bad Request [WWW-Authenticate: OAuth "Facebook Platform" "invalid_code" "Error validating verification code. Please make sure your redirect_uri is identical to the one you used in the OAuth dialog request", Facebook-API-Version: v1.0, Content-Type: text/javascript; charset=UTF-8, Pragma: no-cache, Access-Control-Allow-Origin: *, X-FB-Rev: 1514665, Cache-Control: no-store, Expires: Sat, 01 Jan 2000 00:00:00 GMT, X-FB-Debug: WpyeYYw/BIs08HkafBWcrkbU5tICVgEHTKrPBAiTzZEqjgP3OGCP8eQwNVx2lx6b0iH9GGqIrir3S4iGu7VAIw==, Date: Tue, 02 Dec 2014 09:21:50 GMT, Connection: keep-alive, Content-Length: 190]}
facebook.FacebookAuth com.mydomain.test.pages.facebook.FacebookAuth

可能导致此问题的原因是什么?它与canvas和mobile有关吗?

0 个答案:

没有答案