Facebook登录:无法加载网址此网址的域名不包括在应用的域中 [英] Facebook Login :Can't Load URL The domain of this URL isn't included in the app's domains

查看:7587
本文介绍了Facebook登录:无法加载网址此网址的域名不包括在应用的域中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道许多这样的问题已经被问了很多,然后发布了这个问题。我的问题仍然未解决。



我有一个Web应用程序,我使用Oauth身份验证嵌入了Facebook登录。我使用以下代码进行帮助





所以,我只是想知道为什么我是facin g这个问题。有没有一些我在设置部分缺少的东西?



更新



代码流:



Step1。按钮点击url调用--->

 http://www.facebook.com/dialog/oauth? +client_id =
+ FB_APP_ID +& redirect_uri =
+ URLEncoder.encode(REDIRECT_URI,UTF-8)
+& scope = public_profile

我收到错误,在这个部分给出错误无法加载URL
此网址的域名不包括在应用的域中。为了能够加载此URL,请将应用的所有域和子域添加到应用设置中的应用程序域字段。

解决方案

我想分享两种解决方案。希望它会解决你的问题。



解决方案1:



Facebook现在将一些功能作为插件。在左侧选择产品并添加产品。然后选择Facbook登录。从那里很简单,你会看到所有的Oauth选项都会出现。



OR,



选择产品并添加产品。然后选择Facbook登录。



然后添加 http:// localhost:3000 / 到字段'有效的OAuth重定向URI',然后一切正常。



2:



如果您在Facebook中创建应用程序时输入错误的详细信息,通常会发生。或者您是否更改了现有应用程序的URL?



您可以在此页面中重新检查您的APP的设置吗?



https://developers.facebook.com/apps


  1. 选择正确的应用程序,然后点击编辑按钮;

  2. 检查URL&路径正确输入,并指向您已安装Ultimate Facebook插件的
    网站。

信用转到 Lei lionel



更新1:



我认为您的访问令牌已过期。所以你需要扩展访问令牌。
为此,请通过以下链接:


  1. 扩展Facebook访问令牌(使其最后60天)

  2. 访问令牌的到期和扩展



资源链接:




  1. 生成永不过期 Facebook页面的访问令牌

  2. 做Facebook Oauth 2.0访问令牌过期?



更新2:




我只想问一件事更多是可能应用程序域错误
有访问令牌过期时间吗?




答案:



从服务器端长命令生成长期用户令牌



Facebook有一个高级选项,用于获取应用程序的长期访问令牌:


  1. 有他们自己的身份验证系统(使用用户名/密码为
    示例)

  2. 在他们的服务器上存储一个Facebook访问令牌给使用它
    的用户发送到不同的客户端(浏览器或本地移动应用)

  3. 从所有这些客户端拨打API电话

如果你的应用程序这样设置,它应该使用这里描述的过程从每个客户端获取访问令牌,以避免触发Facebook的自动垃圾邮件系统。最终的结果将是每个客户端都有自己长久的访问令牌。



在高层次上,您可以从中获取长寿命的令牌客户端:


  1. 使用有效的
    当前长寿命的令牌从服务器拨打Facebook的服务器,以生成码。 (这假设你已经通过Facebook登录获得了一个长寿命的令牌
    如果你使用的令牌
    无效或过期,你将不得不获得一个新的
    通过使用户再次使用您的应用程序登录。)

  2. 将该代码安全地发送给客户端。

  3. 客户端然后交换代码长寿命的令牌。

  4. 客户端可以使用长命令来发布故事或查询
    数据。



获取代码



使用长期存在的用户访问令牌,调用以下端点:

  https://graph.facebook.com/oauth/client_code?access_token=...&client_secret=...& redirect_uri = ...& amp; client_id = ... 

您需要输入: code> access_token,client_secret,redirect_uri和client_id。



响应将是:



响应将如下所示:

  {code:....} 



兑换访问令牌的代码



从Facebook的服务器检索代码后,您需要通过安全渠道将其发送给客户端。一旦完成,您需要从客户端向该端点发出请求:

  https://graph.facebook.com /oauth/access_token?code=...&client_id=...&redirect_uri=...&machine_id= ... 

该调用需要以下参数:


client_id - 是

代码 - 是



redirect_uri - 是



machine_id - 否




响应将如下所示:



 code> {access_token:...,expires_in:...,machine_id:...} 


I know many such questions have already been asked tried a lot then after posting the question. My Problem is still unresolved.

I have a web application where I embedded the Facebook login using Oauth Authentication. I used the following code for help Facebook login with Java

Till last month it was working fine but from few days we are coninuously getting the Error : -

Can't Load URL The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings.

**Setting used are following:-
  Website url : **https://www.enggheads.com/**
  App Domain   :  **enggheads.com**
   Redirect uri : 
      1. https://www.enggheads.com/#!login
      2. https://www.enggheads.com/#!signup**

SCREENSHOTS:

So, I just want to know whats the issue why I am facing this problem. Is there something which I am missing in the settings section?

UPDATE

Code flows :

Step1. On button click url called--->

"http://www.facebook.com/dialog/oauth?" + "client_id="
                    + FB_APP_ID + "&redirect_uri="
                    + URLEncoder.encode(REDIRECT_URI, "UTF-8")
                    + "&scope=public_profile ";

I am receiving error on this very part where it gives error Can't Load URL The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings.

解决方案

I want to share 2 ways for making solution. Hope it will solve your issue.

Solution 1:

Facebook now roles some features as plugins. In the left hand side select Products and add product. Then select Facbook Login. Pretty straight forward from there, you'll see all the Oauth options show up.

OR,

Select Products and add product. Then select Facbook Login.

Then added http://localhost:3000/ to the field 'Valid OAuth redirect URIs', and then everything worked.

Solution-2:

It usually happens if you have entered the wrong details when you created the App in Facebook. Or have you changed a URL's of an existing App?

Can you please recheck the settings of your APP in this page?

https://developers.facebook.com/apps

  1. Select the correct App and click in the edit button;
  2. Check the URLs & paths are correctly entered and are pointing to the site where you have installed Ultimate Facebook plugin.

Credit goes to Lei lionel

UPDATE1:

I think your access token already expires. So you need to extend access token. For this, please go through this link:

  1. Extend Facebook access token (make it 60days last)
  2. Expiration and Extension of Access Tokens

Resource Link:

  1. Generate "never-expire" access token for Facebook Page
  2. Do Facebook Oauth 2.0 Access Tokens Expire?

UPDATE2:

I just want to ask 1 thing more is it possible the app domain error has smthng to do with access token expiration time?

Ans:

Generating Long-Lived User Tokens from Server-Side Long-Lived Tokens

Facebook has an advanced option for obtaining long-lived access tokens for apps that:

  1. Have their own authentication system (using a username/password for example)
  2. Store, on their servers, a Facebook access token for people using it that they send to different clients (browser or native mobile apps)
  3. Make API calls from all of those clients

If your app is set up like this it should use the process described here to obtain an access token from each client to avoid triggering Facebook's automated spam systems. The end result will be that each client will have its own long-lived access token.

At a high level, this is how you can obtain a long-lived token from the client:

  1. Make a call to Facebook's server from your server using a valid and current long-lived token to generate a code. (This assumes you've already obtained a long-lived token via Facebook Login. If the token you're using is invalid or expired, you'll have to obtain a new one by making the person using your app log in again.)
  2. Securely send that code to the client.
  3. The client then exchanges the code for a long-lived token.
  4. The client can use the long-lived token to post stories or query data.

Getting the code

Using a long-lived user access token, make a call to the following endpoint:

https://graph.facebook.com/oauth/client_code?access_token=...&client_secret=...&redirect_uri=...&client_id=...

You need to give input: access_token, client_secret, redirect_uri and client_id.

Response will be:

The response will look something like:

{"code": "...."}

Redeeming the code for an access token

Once you've retrieved the code from Facebook's server you then need to ship it to the client via a secure channel. Once that's done, you need to make a request from the client to this endpoint:

https://graph.facebook.com/oauth/access_token?code=...&client_id=...&redirect_uri=...&machine_id= ...

The call requires the following arguments:

client_id - Yes

code - Yes

redirect_uri - Yes

machine_id - No

The response will look like:

{"access_token":"...", "expires_in":..., "machine_id":"..."}

这篇关于Facebook登录:无法加载网址此网址的域名不包括在应用的域中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆