实现自定义流星账户包 [英] Impletmenting a custom meteor accounts package

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

问题描述

我一直在编写自己的流星帐户包,但似乎遗漏了一些东西.我在浏览器或终端中没有收到任何错误,因此我很难进行故障排除.我得到的唯一错误是来自 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.

首先,我没有收到未配置登录服务"错误.你添加了你的包裹吗?我做了流星添加帐户-ui",在我的项目的根目录中创建了一个包文件夹并将您的包文件夹粘贴到其中,将其重命名为帐户-条纹",然后流星添加帐户-条纹".

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}} 助手.有了这个,我得到了配置条纹登录按钮,但当我点击它时它不会打开一个弹出窗口.我在 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"中,然后使用来自 stripe_client.js 和 stripe_server.js 中的配置对象的 appId 检索它们.我注意到这一点是因为提交 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 文档的快速 google 表明我为 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.

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

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