Meteor OAuth Server error: Failed to complete OAuth handshake with Instagram
Meteor OAuth Server error: Failed to complete OAuth handshake with Instagram
我正在使用 https://github.com/meteor-helium/instagram 包来处理 Instagram 登录。
在我的 server/social-config.js 中,我有
ServiceConfiguration.configurations.remove({
service: 'instagram'
});
ServiceConfiguration.configurations.insert({
service: 'instagram',
clientId: '****',
secret: '****'
});
在我的client/main.html中,我有
<template name="login">
{{#if currentUser}}
<button id="logout">Logout</button>
{{else}}
<button id="instagram-login" class="btn btn-default"> Login with Instagram</button>
{{/if}}
</template>
在我的 client/main.js 中,我有
Template.login.events({
'click #instagram-login': function(event) {
Meteor.loginWithInstagram({}, function(err){
if (err) {
throw new Meteor.Error("Instagram login failed");
}
});
},
'click #logout': function(event) {
Meteor.logout(function(err){
if (err) {
throw new Meteor.Error("Logout failed");
}
})
}
});
单击 "Sign in with Instagram" 按钮时出现以下错误
Error in OAuth Server: Failed to complete OAuth handshake with Instagram. failed [400] {"code": 400, "error_type": "OAuthException", "error_message": "Invalid Client Secret"}
我认为根据这个https://github.com/meteor-helium/instagram/blob/master/instagram_configure.js#L10
客户端密钥 属性 名称应该是 clientSecret
,而不是 secret
。
ServiceConfiguration.configurations.insert({
service: 'instagram',
clientId: '****',
clientSecret: '****'
});
我遇到了同样的错误,但是 Google:
app | 2021-09-02T22:36:53.966810914Z Exception while invoking method 'login' Error: Failed to complete OAuth handshake with Google. failed [401] { "error": "unauthorized_client", "error_description": "Unauthorized" }
app | 2021-09-02T22:36:53.966854103Z at getTokens (packages/google-oauth/google_server.js:105:7)
app | 2021-09-02T22:36:53.966858709Z at MethodInvocation.<anonymous> (packages/google-oauth/google_server.js:63:27)
app | 2021-09-02T22:36:53.966863213Z at packages/accounts-base/accounts_server.js:512:31
app | 2021-09-02T22:36:53.966880535Z at tryLoginMethod (packages/accounts-base/accounts_server.js:1305:14)
app | 2021-09-02T22:36:53.966885506Z at AccountsServer._runLoginHandlers (packages/accounts-base/accounts_server.js:510:22)
app | 2021-09-02T22:36:53.966889786Z at MethodInvocation.methods.login (packages/accounts-base/accounts_server.js:570:31)
app | 2021-09-02T22:36:53.966893775Z at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1803:12)
app | 2021-09-02T22:36:53.966897605Z at packages/ddp-server/livedata_server.js:727:19
app | 2021-09-02T22:36:53.966901725Z at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12)
app | 2021-09-02T22:36:53.966905836Z at packages/ddp-server/livedata_server.js:725:46
app | 2021-09-02T22:36:53.966909853Z at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12)
app | 2021-09-02T22:36:53.966913596Z at packages/ddp-server/livedata_server.js:723:46
app | 2021-09-02T22:36:53.966917555Z at new Promise (<anonymous>)
app | 2021-09-02T22:36:53.966922191Z at Session.method (packages/ddp-server/livedata_server.js:697:23)
app | 2021-09-02T22:36:53.966927541Z at packages/ddp-server/livedata_server.js:561:43
客户端是一个 React Native 应用程序,因此,要解决它,请确保在服务器和移动应用程序中使用 相同的 clientId。
下图可以看到不同的Client ID,需要选择Web Client选项:
GCP 平台 -> API & 服务 -> 凭据
此外,请确保为该客户端 ID 记录添加已知域。
这允许在本地主机或具有域的服务器中使用 OAuth Google。
我正在使用 https://github.com/meteor-helium/instagram 包来处理 Instagram 登录。
在我的 server/social-config.js 中,我有
ServiceConfiguration.configurations.remove({
service: 'instagram'
});
ServiceConfiguration.configurations.insert({
service: 'instagram',
clientId: '****',
secret: '****'
});
在我的client/main.html中,我有
<template name="login">
{{#if currentUser}}
<button id="logout">Logout</button>
{{else}}
<button id="instagram-login" class="btn btn-default"> Login with Instagram</button>
{{/if}}
</template>
在我的 client/main.js 中,我有
Template.login.events({
'click #instagram-login': function(event) {
Meteor.loginWithInstagram({}, function(err){
if (err) {
throw new Meteor.Error("Instagram login failed");
}
});
},
'click #logout': function(event) {
Meteor.logout(function(err){
if (err) {
throw new Meteor.Error("Logout failed");
}
})
}
});
单击 "Sign in with Instagram" 按钮时出现以下错误
Error in OAuth Server: Failed to complete OAuth handshake with Instagram. failed [400] {"code": 400, "error_type": "OAuthException", "error_message": "Invalid Client Secret"}
我认为根据这个https://github.com/meteor-helium/instagram/blob/master/instagram_configure.js#L10
客户端密钥 属性 名称应该是 clientSecret
,而不是 secret
。
ServiceConfiguration.configurations.insert({
service: 'instagram',
clientId: '****',
clientSecret: '****'
});
我遇到了同样的错误,但是 Google:
app | 2021-09-02T22:36:53.966810914Z Exception while invoking method 'login' Error: Failed to complete OAuth handshake with Google. failed [401] { "error": "unauthorized_client", "error_description": "Unauthorized" }
app | 2021-09-02T22:36:53.966854103Z at getTokens (packages/google-oauth/google_server.js:105:7)
app | 2021-09-02T22:36:53.966858709Z at MethodInvocation.<anonymous> (packages/google-oauth/google_server.js:63:27)
app | 2021-09-02T22:36:53.966863213Z at packages/accounts-base/accounts_server.js:512:31
app | 2021-09-02T22:36:53.966880535Z at tryLoginMethod (packages/accounts-base/accounts_server.js:1305:14)
app | 2021-09-02T22:36:53.966885506Z at AccountsServer._runLoginHandlers (packages/accounts-base/accounts_server.js:510:22)
app | 2021-09-02T22:36:53.966889786Z at MethodInvocation.methods.login (packages/accounts-base/accounts_server.js:570:31)
app | 2021-09-02T22:36:53.966893775Z at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1803:12)
app | 2021-09-02T22:36:53.966897605Z at packages/ddp-server/livedata_server.js:727:19
app | 2021-09-02T22:36:53.966901725Z at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12)
app | 2021-09-02T22:36:53.966905836Z at packages/ddp-server/livedata_server.js:725:46
app | 2021-09-02T22:36:53.966909853Z at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12)
app | 2021-09-02T22:36:53.966913596Z at packages/ddp-server/livedata_server.js:723:46
app | 2021-09-02T22:36:53.966917555Z at new Promise (<anonymous>)
app | 2021-09-02T22:36:53.966922191Z at Session.method (packages/ddp-server/livedata_server.js:697:23)
app | 2021-09-02T22:36:53.966927541Z at packages/ddp-server/livedata_server.js:561:43
客户端是一个 React Native 应用程序,因此,要解决它,请确保在服务器和移动应用程序中使用 相同的 clientId。
下图可以看到不同的Client ID,需要选择Web Client选项:
GCP 平台 -> API & 服务 -> 凭据
此外,请确保为该客户端 ID 记录添加已知域。
这允许在本地主机或具有域的服务器中使用 OAuth Google。