node.js 使用回调 url 创建 facebook 应用程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15036706/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Creating facebook app with callback url
提问by Selvaraj M A
I am creating a facebook app. And I want to let users to login to my website using it(Using passportjs).
我正在创建一个 facebook 应用程序。我想让用户使用它登录我的网站(使用passportjs)。
But to do that, I need to give callback url(my website url). But I couldn't find that field in the facebook app creating page.
但要做到这一点,我需要提供回调网址(我的网站网址)。但我在 facebook 应用程序创建页面中找不到该字段。
Am I missing something? I have searched for it for a quite long time.
我错过了什么吗?我已经搜索了很长时间。
回答by Mic Fok
Writing as of Feb 2, 2014 I found these instructions to be current;
截至 2014 年 2 月 2 日,我发现这些说明是最新的;
- Go to your app
- On the left-hand sidebar, click Settings
- Under the main section, click Add Platform
- Click 'Website'
- Specify your callback in the Site URL field (e.g.
http://localhost:3000/auth/facebook/callback).
- 转到您的应用
- 在左侧边栏上,单击设置
- 在主要部分下,单击添加平台
- 点击“网站”
- 在站点 URL 字段中指定您的回调(例如
http://localhost:3000/auth/facebook/callback).
回答by Stanley
- Go to your app.
- On the left-hand sidebar, click Settings.
- Under the main section, click Add Platform.
- Click 'Website'.
- Specify your callback in the Site URL field (e.g. http://localhost:3000/auth/facebook/callback).
- 转到您的应用程序。
- 在左侧边栏上,单击设置。
- 在主要部分下,单击添加平台。
- 点击“网站”。
- 在站点 URL 字段中指定您的回调(例如http://localhost:3000/auth/facebook/callback)。
回答by sivanagaraju
Call back URL must be provided in the Clint O auth settings in order the facebook to send the user credentials and access Token after user logged into facebook through your app. Facebook's developer website UI was changed again. Now the client OAuth settings block was moved into Facebook Login. To provide the callback URL Now the path is
必须在 Clint O 身份验证设置中提供回调 URL,以便 facebook 在用户通过您的应用登录 facebook 后发送用户凭据和访问令牌。Facebook 的开发者网站 UI 再次更改。现在客户端 OAuth 设置块已移至 Facebook 登录。提供回调 URL 现在路径是
Your App Dashboard > On the Left-hand sidebar > facebook login > Clint Oauth Settings > Valid OAuth redirect URIs
您的应用仪表板 > 在左侧边栏 > facebook 登录 > Clint Oauth 设置 > 有效的 OAuth 重定向 URI
回答by otterslide
The "Callback URL" is the URL that will be contacted once the user has accepted or rejected the OAuth request.
“回调 URL”是用户接受或拒绝 OAuth 请求后将联系的 URL。
This is set as a parameter of your OAuth request. So you set the URL in your own program, not somewhere in Facebook.
这被设置为您的 OAuth 请求的参数。所以你在你自己的程序中设置 URL,而不是在 Facebook 的某个地方。
In Java/Spring social you would do:
在 Java/Spring social 中,你会这样做:
OAuth2Parameters params = new OAuth2Parameters();
params.setRedirectUri("http://yoursite/callback");
Once you set this, it must also match a "Valid OAuth Redirect URL" as sivanagaraju's answer mentions, otherwise Facebook will reject it. In the "Facebook Login" tab under your app, enter all valid callback URL's, such as http://localhost/callback, http://productionUrl/callback, etc.
设置后,它还必须与 sivanagaraju 的回答中提到的“有效的 OAuth 重定向 URL”匹配,否则 Facebook 将拒绝它。在您的应用程序下的“Facebook 登录”选项卡中,输入所有有效的回调 URL,例如http://localhost/callback、http://productionUrl/callback等。
If you don't see "Facebook Login" tab under your app, click "Add Product-> Facebook Login->Get Started" Enter the Valid Callback Urls -> Save changes.
如果在您的应用程序下没有看到“Facebook 登录”选项卡,请单击“添加产品-> Facebook 登录->开始”输入有效的回调网址 -> 保存更改。
回答by Aspen
- Go to the Facebook developer page.
- In the left hand side bar, under 'Products' you'll either see or need to add the Facebook Login product.
- Once you've added it, you can go to Facebook Login settings and add your URL to 'Valid OAuth redirect URIs'
- 转到 Facebook 开发人员页面。
- 在左侧栏中的“产品”下,您将看到或需要添加 Facebook 登录产品。
- 添加后,您可以转到 Facebook 登录设置并将您的 URL 添加到“有效的 OAuth 重定向 URI”

