本文介绍了完成自定义流星帐户程序包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在编写自己的流星帐户程序包,但似乎丢失了一些东西.我在浏览器或终端上没有出现任何错误,因此很难进行故障排除.我收到的唯一错误是从accounts-ui软件包本身发出的,上面写着未配置登录服务".可以在 https://github.com/khamoud/meteor-accounts-stripe如果有人可以看看.预先感谢.

I have been writing my own meteor accounts package and I seem to be missing something. I am not getting any errors in the browser or in the terminal so it's difficult for me to troubleshoot. The only error I get is from the accounts-ui package itself which is saying 'No login services configured.' The code can be seen at https://github.com/khamoud/meteor-accounts-stripe if anyone could take a look. Thanks in advance.

推荐答案

我前一段时间自己创建了一个帐户包,我的建议是坚持使用同一服务的基本帐户包中的所有操作(在这种情况下, OAuth 2看起来像).我可以看到您已经做到了,但有一些细微的差别.

I created a accounts package myself a while ago and my advice would be to stick to whatever is done in the base accounts packages of the same service (in this case OAuth 2 it looks like) as closely as possible. I can see you have done that but there are minor differences.

我下载了您的软件包并尝试了一下.虽然我无法使其正常运行(我没有使用Stripe API,所以我不会完全研究它),但我认为我可以取得比您更大的进步.

I downloaded your package and tried it out myself. While I can't get it working (I haven't used the Stripe API so I wont be digging into it completely) I think I can make more progress than you have had.

首先,我没有收到未配置登录服务"错误.您是否添加了包裹?我做了'meteor add accounts-ui',在我项目的根目录下创建了一个packages文件夹,并将您的package文件夹粘贴到其中,将其重命名为'accounts-stripe',然后做了'meteor add accounts-stripe'.

First of all I don't get a 'No login services configured' error. Did you add your package? I did 'meteor add accounts-ui', created a packages folder in the my project's root and pasted your package folder into it, renamed it 'accounts-stripe' and did 'meteor add accounts-stripe'.

然后,我在页面上添加了一个{{loginButtons}}助手.有了这个,我得到了配置Stripe登录按钮,但是当我单击它时它不会打开一个弹出窗口.我在js控制台中收到一条错误消息未捕获的错误:重复的服务:条带".问题似乎是您所在的行:

I then added a {{loginButtons}} helper to the page. With this I got the configure Stripe login buttons but it wouldn't open a pop-up when I clicked on it. I got an error message in the js console 'Uncaught Error: Duplicate service: stripe'. The problem seems to be you have the line:

Accounts.oauth.registerService('stripe');

accounts_stripe.js和stripe_client.js中的

.从stripe_client.js中删除它为我修复了它.然后,我可以从Stripe添加我的API密钥.

in both accounts_stripe.js and stripe_client.js. Removing it from stripe_client.js fixed it for me. I could then add my API keys from stripe.

下一个问题是,一旦提交了这些文件,便将它们存储在stripe_configure.js的"clientId"中,然后使用appId从stripe_client.js和stripe_server.js中的配置对象中检索它们.我注意到了这一点,因为提交API密钥后弹出窗口中的登录URL有未定义的client_id.在stripe_configure.js中将"clientId"更改为"appId"将解决此问题.

The next problem is once these are submitted you store them in 'clientId' in stripe_configure.js but then retrieve them using appId from the config object in stripe_client.js and stripe_server.js. I noticed this because the login URL in the pop-up after submitting the API keys had a undefined client_id. Changing 'clientId' to 'appId' in stripe_configure.js will fix that.

不幸的是,它仍然无法正常工作.我得到

Unfortunately it still doesn't work. I get

{"error":{"message":"No application matches the supplied client identifier"}}

从弹出窗口中.这可能有多种原因,可能是我在API密钥窗口中提交了错误的内容,可能是因为我在Stripe上使用了测试项目,或者您执行的登录工作流程不正确. Stripe OAuth文档的快速谷歌搜索结果表明我为client_id和secret提交了错误的内容.就像我说过的,我之前从未使用过Stripe API.

from the pop-up window. This could be for any number of reasons, perhaps I submitted the wrong thing in the API keys window, maybe it's because I'm using a test project on Stripe, or maybe you have implemented the login workflow incorrectly. A quick google of the Stripe OAuth docs suggests that I have submitted the wrong things for the client_id and secret. Like I said I haven't used the Stripe API before.

我希望我能帮助您开始修复它.

I hope I have got you started on fixing it though.

这篇关于完成自定义流星帐户程序包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-17 02:58
查看更多