I am trying to get OAuth access token for one of the published APIs. I have defined a local scope “XYZ_Scope” for the API resource. When I go the DevPortal I am able to generate scope defined scope using the UI but no using the curl command.
Here is how the curl command looks like:
curl --location 'https://{your-ip-address}:9443/oauth2/token'
--header 'Authorization: Basic Base64(consumer-key:consumer-secret)'
--header 'Content-Type: application/x-www-form-urlencoded'
--data-urlencode 'grant_type=password'
--data-urlencode 'username=username'
--data-urlencode 'password=password'
Here is how the response look:
{
"access_token": "*token*",
"scope": "default",
"token_type": "Bearer",
"expires_in": 3600
}
I am not able to access the published API using the access token. Here is the issue I am facing:
{
"code": "900910",
"message": "The access token does not allow you to access the requested resource",
"description": "User is NOT authorized to access the Resource: /{device-name}/{resource-name}. Scope validation failed."
}
Is there a possibility that I can add my local scope to the curl command to get the access token?
Thank you for answering.