Quantcast
Channel: Square Developer Forums - Latest topics
Viewing all articles
Browse latest Browse all 1325

Revoke oauth token with Node.js SDK

$
0
0

I am using the Node.js SDK successfully for several API calls, but cannot get oAuthApi.revokeToken to work . This is my code -

const newclient = client.withConfiguration({
accessToken: 'Client '+process.env.SQUARE_APPLICATION_SECRET,
});

const response = await newclient.oAuthApi.revokeToken({
clientId: process.env.SQUARE_APPLICATION_ID,
accessToken: square.access_token, // token to be revoked
revokeOnlyAccessToken: false,
});

I get the following error -

“Argument for ‘authorization’ failed validation.\n\nExpected value to be of type ‘string’ but found ‘undefined’.\n\nGiven value: undefined\nType: ‘undefined’\nExpected type: ‘string’”

It works in API Explorer with identical values if I input Client + the application secret in the “Access token” field at the top of the page.

But using the same Client + application secret in the .withconfiguration function call in my code does not work.

I am using sandbox mode.

Please advise what I am doing wrong.

Thanks.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 1325

Trending Articles