Oauth URL Difficulty - Unable to find client by that client_id

Good afternoon,

I have been struggling to get my authentication url working for my external application. I’m currently working in a sandbox environment, in which I have a test user on my application try to connect with the redirect url to make an oauth token exchange.

The first few times I ran it, I got to the squareup screen that asked for username and password. Unsure what to do, I put my dev email in and password. got denied. Then I tried it again with the fake sandbox account, then didn’t know what password to use - of course then could not make the connection.

Now whenever I try again I get the unable to find client by that client_id error.

Here’s my endpoint code from python:

def get_square_auth_url(request: Request):

state_string = generate_state_string() # Add or remove scopes as needed
request.session['oauth_state'] = state_string
auth_url = (
    f"&scope={' '.join(scopes)}"
print("constructed auth url: ", auth_url)
return auth_url

and the url that appears in my browser


I have tried both with and without a state string with the same error appearing. So I’m now really questioning if square is reading my app ID correctly? It appears correctly in my url when the endpoint is hit

Hi @nick_p ,

I think there’s a few things happening here, preventing your attempt to work.

  1. You can only test sandbox OAuth within your own Square account. If you have a test user, who is a Square merchant, with their own Square account, you can only connect them with OAuth via production.
  2. If you are trying to create a sandbox OAuth link you will need to use a Authorization URL with this URL: https://connect.squareupsandbox.com/oauth2/authorize?client_id={sandbox application id}&scope=MERCHANT_PROFILE_READ instead of https://connect.squareup.com/oauth2… This was
    why you got a client_it error, mismatching a production OAuth url with sandbox application id.

For the Square merchant trying to provide OAuth permission to your application, the login in should be the same as Seller Dashboard (same as Developer Dashboard).

Let me know if you have any other questions with your OAuth attempt.

Hi Lance,

Thank you that worked for me! Once I adjusted the url to include sandbox, the flow worked just fine!

Just to confirm, once I’m ready for a production setting, the original url I was using would suffice for my needs?


Yes, that’s right. The original URL was the production OAuth Authorization URL - https://squareup.com/oauth2/authorize?client_id=