- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Getting "not authorized" error when trying to exchange code for access token
Hi all -
Hoping someone can help with this.
I can successfully generate the URL to prompt for permissions form.
However, after the user accepts, we are trying to exchange the code returned for a token.
However, when we attempt to use the code provided, we get an error response for the access token saying:
{"message"=>"Not Authorized", "type"=>"service.not_authorized"}
Any assistance is appreciated. Agian, this is AFTER the permission link has been clicked and approved.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
Hi!
Sorry that you are having troubles, (and I hope your hoiday season was nice!) but I'll see if I can help.
What is your application id? And which programming language are you using? It sounds like you might be malforming, or mixing up your request to the endpiont, so any code you could share, would be helpful as well!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
Hi, I am also getting the error.
{ "message": "Not Authorized", "type": "service.not_authorized" }
I get the code and redirect as I was supposed to, but when I try to send cliend_id, client_secret and code to https://connect.squareup.com/oauth2/token I am getting the error above.
App id: sandbox-sq0idp-TZyrZ3dg61kqmEp0ZakxVQ
PHP is being used.
Cheers,
Alek
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
I am also having the same problem. I am using the java oauth connect-examples code.
App ID: sq0idp-udjQPpkVMEOa6QIiFf8Cpw
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
Hello @vuusa2000! If you're still experiencing this issue please start a case with our API CS team and they'll be able to investigate this further. Thanks for your patience!
Seller Community Manager
Did you find help in the Seller Community? Mark a Best Answer to help others.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
I'm also getting this error.
From php code, javascript code and their example wen page they have to test it
https://developer.squareup.com/explorer/square_2019-12-17/oauth-api/obtain-token
I follow the link, it returns me to a page with the code in the querystring,
I come here and put that code along with my id key and authorization_code for the type.
Press run request. and error 401
{
"message": "Not Authorized",
"type": "service.not_authorized"
}
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
Hi @werdemup,
I'd recommend contacting our API team with the link Helen provided in the comment above yours to take a closer look.
We don't have the API training here on the Community team to be able to assist with this directly.
Community Moderator, Square
Sign in and click Mark as Best Answer if my reply answers your question.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
Check that you are using correct url endpoint. I have used "https://connect.squareup.com/oauth2/token" in sandbox, but should use "https://connect.squareupsandbox.com"
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report