Receive V1_ERROR with code Uknown when trying to obtain token after redirecting from Oauth page

Here is what I receive after sending request to obtain token method with code recived from Oauth page.
“Square\Models\Error”:{“category”:“V1_ERROR”,“code”:“Unknown”}}

My Oauth link is below:
https://connect.squareupsandbox.com/oauth2/authorize?client_id=[id]&scope=MERCHANT_PROFILE_READ,PAYMENTS_READ,SETTLEMENTS_READ,BANK_ACCOUNTS_READ,BANK_ACCOUNTS_READ&session=false&redirect_uri=[uri]

Code responsible for obtaining token (PHP):

$body = new ObtainTokenRequest($this->applicationId, 'authorization_code');
$body->setScopes([
        'MERCHANT_PROFILE_READ',
        'PAYMENTS_READ',
        'BANK_ACCOUNTS_READ',
        'SETTLEMENTS_READ',
        'BANK_ACCOUNTS_READ',
]);
$body->setClientSecret($this->applicationSecret);
$body->setRedirectUri($this->redirectUrl);
$body->setCode($code);

$apiResponse = $client->getOAuthApi()->obtainToken($body);

What can be wrong?

Also, I issued some problems with Log In, and receive the message that Square is blocked in Ukraine, maybe that is the reason of such behavior.

The owner of this website (developer.squareup.com) has banned the country or region your IP address is in (UA) from accessing this website.

Need urgent help!

1 Like

Yes, as per regulatory sanctions we do restrict traffic to certain regions. If your are in one of these sanctioned regions you won’t be able to use Square. :slightly_smiling_face:

How I can develop functionality for my customer located in USA if I am in Ukraine?

1 Like

@Bryan-Square please help me.

At this time we don’t have a recommended work around since this is government mandated. :slightly_smiling_face:

Just install VPN and that’s it. With VPN it works. @Bryan-Square make some updates to API, so developers will know where to dig in to fix it. Because V1_ERROR & Unknown doesn’t give any idea what’s wrong.

1 Like