Search code examples
meteoroauthinstagram

Meteor OAuth Server error: Failed to complete OAuth handshake with Instagram


I'm using https://github.com/meteor-helium/instagram package to handle Instagram login.

In my server/social-config.js, I have

ServiceConfiguration.configurations.remove({
    service: 'instagram'
});
ServiceConfiguration.configurations.insert({
    service: 'instagram',
    clientId: '****',
    secret: '****'
});

In my client/main.html, I have

<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>

In my client/main.js, I have

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");
        }
    })
}
});

I get the following error when I click the "Sign in with Instagram" button

Error in OAuth Server: Failed to complete OAuth handshake with Instagram. failed [400] {"code": 400, "error_type": "OAuthException", "error_message": "Invalid Client Secret"}

Solution

  • I think that according to this https://github.com/meteor-helium/instagram/blob/master/instagram_configure.js#L10 The client secret property name should be clientSecret, not secret.

    ServiceConfiguration.configurations.insert({
        service: 'instagram',
        clientId: '****',
        clientSecret: '****'
    });