[英]Meteor loginWithApple oauth - “Service not configured”
I'm adding Apple login, the latest oauth package to join Meteor, but I'm running into the error message "Service not configured" .我正在添加Apple登录,最新的oauth package加入Meteor,但我遇到错误消息“服务未配置” 。 It seems that a lot of the solutions [ another ] talk about using
ServiceConfiguration
to fix these errors, but I haven't had to initialize any of the other meteor logins such as loginWithGoogle
or loginWithFacebook
.似乎很多解决方案[ 另一个] 都在谈论使用
ServiceConfiguration
来修复这些错误,但我不必初始化任何其他 meteor 登录,例如loginWithGoogle
或loginWithFacebook
。 Based on my reading through the github package Meteor.loginWithApple is configured the same way as these existing login functions.根据我对 github package Meteor.loginWithApple 的配置方式与这些现有登录功能相同。 What configuration issue might be triggering this?
什么配置问题可能会触发此问题?
When I look at Meteor.settings.private.oAuth
, apple
is right there alongside google
and facebook
.当我查看
Meteor.settings.private.oAuth
时, apple
就在google
和facebook
。
First, I installed these two https://atmospherejs.com/quave/accounts-apple , https://atmospherejs.com/quave/apple-oauth首先,我安装了这两个https://atmospherejs.com/quave/accounts-apple , https://atmospherejs.com/quave/apple-oauth
meteor add quave:accounts-apple
meteor add quave:apple-oauth
Then set up the config
in settings.json
alongside facebook and google oauth
per this guide .然后按照本指南在
settings.json
以及 facebook 和谷歌oauth
中设置config
。
settings.json :设置.json :
"apple": {
"teamId": "yyexamplexx",
"clientId": "com.example.client",
"keyId": "zzexamplewq",
"secret": "zxcvsdfasdfexamplezlongstrxcvsdfasdf",
"redirectUri": "https://example.com/apple-redirect"
},
Client :客户:
continueWithApple = () => {
Meteor.loginWithApple({}, function(err, res) {
if (err) {
console.log(err);
}
//running ok
});
};
<Form.Button
id="appleid-signin"
fluid
basic
className="continue apple"
data-color="black"
data-border="true"
data-type="sign in"
onClick={() => {
this.continueWithApple();
}}
>
For some reason the config oauth
settings aren't being passed on, so we had to do something like the following in order to set up the credentials and stop the "Service not configured" error message:由于某种原因,配置
oauth
设置未传递,因此我们必须执行以下操作才能设置凭据并停止“服务未配置”错误消息:
Meteor.startup(() => {
// remove any existing service so you can configure the latest one
Accounts.loginServiceConfiguration.remove({ service: "apple" });
// setup apple login, drawing from your settings.json
Accounts.loginServiceConfiguration.insert(Meteor.settings.private.oAuth.apple);
...
)}
Our configuration looked something like:我们的配置看起来像:
"private": {
"oAuth": {
"apple": {
"secret": "-----BEGIN PRIVATE KEY-----\nxyzexamplexyz\n-----END PRIVATE KEY-----",
"redirectUri": "https://www.example.com/_oauth/apple",
"clientId": "com.example.client",
"teamId": "WXYZ8EXAMPLE",
"keyId": "456EXAMPLE",
"scope": "name%20email",
"responseMode": "form_post",
"responseType": "code",
"service": "apple"
}
It seems to be important that the redirectUri
ends with _oauth/apple
since meteor's loginWithApple
is looking for that. redirectUri
以_oauth/apple
结尾似乎很重要,因为流星的loginWithApple
正在寻找它。 Didn't need to handle the callback at all, the packages below take care of it.根本不需要处理回调,下面的包会处理它。
meteor add quave:accounts-apple
meteor add quave:apple-oauth
Also important to put the %20
in the scope name%20email
...it just worked .将
%20
放入 scope name%20email
中也很重要……它刚刚起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.