Sandbox authorization url

i am building my auth url. i get it to work fine in production, but for sandbox, i keep on getting a 400 bad request.

the url is something like:

https://squareupsandbox.com/oauth2/authorize?client_id={client-id}&scope=ITEMS_READ+ITEMS_WRITE+&session=false&state=5ec7fa6887230&redirect_uri=https://somedomain.com/square.php

now, it works fine when the domain goes to:

https://connect.squareup.com/oauth2/authorize?

but when i change it to sandbox, ie

https://connect.squareupsandbox.com/oauth2/authorize?

it redirects to:

https://squareupsandbox.com/oauth2/authorize?

and then i get a 400 error.

what might i be doing wrong here?

:waving_hand: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:
https://developer.squareup.com/docs/oauth-api/walkthrough2

Additional Documentation

Move OAuth from the Sandbox to Production
OAuth Walkthrough: Test Authorization with Web Server
Create the Redirect URL and Square Authorization Page URL

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

Do you have the sandbox Seller Dashboard open in another tab when trying to do OAuth isn sandbox? It required when doing OAuth in sandbox. :slight_smile:

who knew?

so specifically i need to go:

  • account
  • developer console
  • sandbox test account
  • square dashboard

in trying to navigate through my account, what is the quickest way to get to the developer console?

thanks for the help!

also, does the sandbox seller dashboard need to be open when obtaining a new sandbox oauth token using a refresh token?

Yes, that’s how to get to the sandbox Dashboard.

No, it doesn’t since those are server side API calls. :slight_smile: