Techofficer / node-apple-signin

Node.JS wrapper around Sign In with Apple REST API
MIT License
53 stars 40 forks source link

Getting error "invalid_grant" #13

Closed co2nut closed 4 years ago

co2nut commented 4 years ago

Follow example and perform the following

   const clientSecret = appleSignin.getClientSecret({
        clientID: "com.xxx.client", // identifier of Apple Service ID.
        teamId: "xxxxxx", // Apple Developer Team ID.
        privateKeyPath: __dirname + "/authkey.p8", // path to private key associated with your client ID.
        keyIdentifier: "xxx" // identifier of the private key.
    });

    const options = {
        grant_type: 'authorization_code',
        clientID: "com.xxx.client", // identifier of Apple Service ID.
        redirectUri: "http://xxx.my/redirect", // use the same value which you passed to authorisation URL.
        clientSecret: clientSecret
    };

    appleSignin.getAuthorizationToken(accessToken, options).then(tokenResponse => {
        console.log(tokenResponse);
    }).catch(error => {
        console.log(error);
    });

accessToken is the getting from ios apps apple sign in

gustavoferreirads commented 4 years ago

Same here, any update? @co2nut

co2nut commented 4 years ago

@gustavoferreirads I'm actually created extra identifiers which is for the RESTFUL API usage. I remove it and use the existing identifier which i created earlier for my apps. Then I create the key for this identifier and it works.