I’m unable to obtain oAuth Access Token. The API Obtain token returns “Authorization code not found for app [sandbox-sq0idb-Id892Gi_zNR0c8naV275ew]”
Details below:
-
Account : [email protected]
-
Application : siraasganpoc
-
List Locations API returns the location
curl https://connect.squareupsandbox.com/v2/locations \
-H 'Square-Version: 2022-11-16' \
-H 'Authorization: Bearer ***' \
-H 'Content-Type: application/json'
Response:
{
“locations”: [
{
“id”: “L8JA7YYVPSKWH”,
“name”: “[email protected]”,
“address”: {
“address_line_1”: “1600 Pennsylvania Ave NW”,
“locality”: “Washington”,
“administrative_district_level_1”: “DC”,
“postal_code”: “20500”,
“country”: “US”
},
“timezone”: “UTC”,
“capabilities”: [
“CREDIT_CARD_PROCESSING”,
“AUTOMATIC_TRANSFERS”
],
“status”: “ACTIVE”,
“created_at”: “2022-11-24T03:36:51.845Z”,
“merchant_id”: “MLCF4CMBXQ0QF”,
“country”: “US”,
“language_code”: “en-US”,
“currency”: “USD”,
“business_name”: “[email protected]”,
“type”: “PHYSICAL”,
“business_hours”: {},
“mcc”: “7299”
}
]
}
- Create Mobile Authorization Code returns Authorization Code
curl https://connect.squareupsandbox.com/mobile/authorization-code
-X POST
-H ‘Square-Version: 2022-11-16’
-H ‘Authorization: Bearer ***’
-H ‘Content-Type: application/json’
-d ‘{
“location_id”: “L8JA7YYVPSKWH”
}’
Response:
{
“authorization_code”: “sandbox-sq0acb-V0eOUPT331jgLScVwEiL3Zq3VoI6PuKunYkJCUmP_iI”,
“expires_at”: “2022-11-26T00:30:13Z”
}
- Obtain Token API Returns below error
curl https://connect.squareupsandbox.com/oauth2/token
-X POST
-H ‘Square-Version: 2022-11-16’
-H ‘Content-Type: application/json’
-d ‘{
“grant_type”: “authorization_code”,
“redirect_uri”: “http://localhost:5150/”,
“client_id”: “sandbox-sq0idb-Id892Gi_zNR0c8naV275ew”,
“client_secret”: “***”,
“code”: “sandbox-sq0acb-V0eOUPT331jgLScVwEiL3Zq3VoI6PuKunYkJCUmP_iI”
}’
Response:
{
“errors”: [
{
“category”: “AUTHENTICATION_ERROR”,
“code”: “UNAUTHORIZED”,
“detail”: “Authorization code not found for app [sandbox-sq0idb-Id892Gi_zNR0c8naV275ew]”
}
]
}
Appreciate any help
Thanks!!