You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior
I was using the revokeToken in the oauth api to revoke all tokens and I had no issue. Then when I started using it to revoke a single token I started getting a "bad authorization header" error back.
After checking out the Square SDK source code I realized my assumption that "Client " is automatically prepended onto the authorization header was false.
The documentation does state that it needs to be in the format: Authorization: Client APPLICATION_SECRET however it's a bit confusing in the way it states this:
* __Important:__ The `Authorization` header for this endpoint must have the
* following format:
*
*
* Authorization: Client APPLICATION_SECRET
*
The user for this function is not manually manipulating headers (or authorization headers). The API of the function asks for
authorization: string
Whose comment is @param authorization Client APPLICATION_SECRET
It would be simpler if it simply asks for the client application secret, and not for the client application secret with "Client " prefixed onto it.
Alternatively you could rename authorization to authorizationHeader so it's clear that the user is passing in the entire header line, not just the application secret. Most other SDK's that do similar things don't require the user to pass in the "Client " part.
ATTENTION
This issue template is for bugs or documentation errors in this SDK Repo. Please direct all technical support questions, feature requests, API-related issues, and general discussions to our Square-supported developer channels. For public support, join us in our Square Developer Discord server or post in our Developer Forums. For private support, contact our Developer Success Engineers directly.
Describe the bug
The api design for
OAuthApi.revokeToken
is confusingsquare-nodejs-sdk/src/api/oAuthApi.ts
Line 47 in 1d04b86
Expected behavior
I was using the
revokeToken
in the oauth api to revoke all tokens and I had no issue. Then when I started using it to revoke a single token I started getting a "bad authorization header" error back.After checking out the Square SDK source code I realized my assumption that
"Client "
is automatically prepended onto the authorization header was false.The documentation does state that it needs to be in the format:
Authorization: Client APPLICATION_SECRET
however it's a bit confusing in the way it states this:The user for this function is not manually manipulating headers (or authorization headers). The API of the function asks for
authorization: string
Whose comment is
@param authorization Client APPLICATION_SECRET
It would be simpler if it simply asks for the client application secret, and not for the client application secret with
"Client "
prefixed onto it.Alternatively you could rename
authorization
toauthorizationHeader
so it's clear that the user is passing in the entire header line, not just the application secret. Most other SDK's that do similar things don't require the user to pass in the"Client "
part.Square SDK version
For example: 38.1.0
Additional context
square-nodejs-sdk/src/api/oAuthApi.ts
Line 47 in 1d04b86
The text was updated successfully, but these errors were encountered: