流星帐户推特无法正常工作 [英] Meteor accounts-twitter unable to get working
问题描述
我去过流星。我想使用OAuth对我的网站上的用户进行身份验证,因为我不想自己实现登录功能。
I've been having a go at Meteor. I want to use OAuth to authenticate users on my site as I do not want to implement the login features myself.
目前,我的网站非常简单。计数器,单击按钮会使计数器增加一。这样的想法一直存在,那就是用户何时转到另一台计算机并登录其计数。
At the moment my website is very simple. A counter, where you click a button the counter increases by one. The idea being when a user goes to another machine and logs in their count is persisted.
我已经按照 meteor.com/accounts 。
-
流星添加帐户-推特
和流星添加帐户-ui
- 添加了
{{>登录按钮}}
到HTML。 - 在Cloud9终端
meteor --port $ IP:$ PORT
- 按照 apps.twitter.com 上的屏幕说明进行操作
- 设置网站
abc-matthewcanty.c9.io /
- 设置回调URL
http://0.0.0.0:8080/_oauth/twitter
-这就是我要做的事情。 - 复制到
API密钥
和API秘密
- 选择基于弹出窗口的身份验证并按保存
meteor add accounts-twitter
andmeteor add accounts-ui
- Added
{{> loginButtons}}
to HTML. - In Cloud9 terminal
meteor --port $IP:$PORT
- Followed the on screen instructions on apps.twitter.com
- Set website
abc-matthewcanty.c9.io/
- Set callback URL
http://0.0.0.0:8080/_oauth/twitter
- this is what I am told to do. - Copied in
API Key
andAPI Secret
- Chose pop-up based authentication and pressed save
现在,当我单击使用Twitter登录时,我会弹出一个对话框:
Now when I click Sign in with Twitter I get a pop up which says:
此网页不可用
This webpage is not available
ERR_ADDRESS_INVALID
ERR_ADDRESS_INVALID
弹出窗口的地址如下:
0.0.0.0:8080/_oauth/twitter/? requestTokenAndRedirect = true& state = eyJsb2dpblN ......
0.0.0.0:8080/_oauth/twitter/?requestTokenAndRedirect=true&state=eyJsb2dpblN......
注意,使用 abc-matthewcanty.c9.io /
作为回调URL没什么区别。
Note that using abc-matthewcanty.c9.io/
as the Callback URL makes not difference.
这是因为我正在使用 Cloud9 IDE ,所以我需要进行一些修补
Is this because I am using Cloud9 IDE and there is a little more tinkering that I have to do?
流星文档没有提供进一步的步骤。
The Meteor documentation provides no further steps. Probably assumes knowledge of OAuth as a prerequisite but does not state as such.
编辑
我访问了以下@ tomas-hromnik建议的站点:
I visited the site suggested by @tomas-hromnik below:
http://www.servicepro.wiki/wiki/117/cloud9-twitter-account-integration-for-sign-up
并更新了apps.twitter.com中的应用设置:
And updated the app settings in apps.twitter.com:
- 网站: https://abc-matthewcanty.c9.io/
- 回调URL: https://abc-matthewcanty.c9.io/ 也尝试过这与 _oauth / twitter?close
- Website: https://abc-matthewcanty.c9.io/
- Callback URL: https://abc-matthewcanty.c9.io/ also tried this with _oauth/twitter?close
当我单击按钮时,我不知道如何阻止它进入 http://0.0.0.0:8080/etc
When I click on the button I don't know how to stop it from going to http://0.0.0.0:8080/etc
推荐答案
以下是使Twitter身份验证与Cloud9上的Meteor配合使用所需的步骤:
Here are the steps you need to do to make Twitter auth work with Meteor on Cloud9:
- 确保您的应用程序是公开的,而不是私有的。您可以通过以下方法执行此操作:单击共享,然后在Cloud9工作区中选中应用程序旁边的公用。
- 确保将Twitter回调设置为
https: //< workspace-name>-<用户名> .c9users.io
- 由于Meteor twitter auth软件包默认使用
0.0 .0.0:8080
(以IP:PORT开头的地址)作为回调主机,因此您需要添加ROOT_URL
环境变量。如果您使用的是Cloud9 Runner,则可以通过在运行面板上单击 ENV按钮并添加它来添加环境变量。将ROOT_URL设置为应用程序的外部URL。否则,您只需在终端中输入以下内容即可:$ export ROOT_URL ='https://< workspace-name>-< username> .c9users.io /'
- Make sure your application is Public, not private. You can do that by clicking on 'Share', and checking Public next to 'Application' within your Cloud9 workspace
- Make sure you set the twitter callback as
https://<workspace-name>-<username>.c9users.io
- Since Meteor twitter auth package defaults to using
0.0.0.0:8080
(the IP:PORT you start it with) as the callback host, so you need to add theROOT_URL
environment variable. If you're using a Cloud9 runner, you can add environment variables by clicking on the 'ENV' button on the run panel and adding it. Set ROOT_URL to your application's external URL. Otherwise you can just do it within the terminal by typing in:$ export ROOT_URL='https://<workspace-name>-<username>.c9users.io/'
注意:请注意,默认情况下,Meteor从端口3000开始,但是您需要设置端口到8080,以使其工作。
Note: Please note that by default Meteor starts at port 3000, but you need to set the port to 8080 in order to make it work.
这篇关于流星帐户推特无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!