[invalidAuthorizationToken] Getting auth error when trying to access public resource
Closed this issue · 2 comments
Hi there. I am new to IUDX at the moment.
I was trying to make GET call (using bearer auth token) to datakaveri.org/04a15c9960ffda227e9546f3f46e629e1fe4132b/rs.iudx.org.in/pune-env-aqm/f36b4669-628b-ad93-9970-f9d424afbf75 which appears to be a public resource.
It is giving invalidAuthorizationToken error to me. The exact request/response is:
request:
GET https://rs.iudx.org.in/ngsi-ld/v1/entities/?id=datakaveri.org/04a15c9960ffda227e9546f3f46e629e1fe4132b/rs.iudx.org.in/pune-point-of-interests/pa-locations
response:
{
"type": "urn:dx:rs:invalidAuthorizationToken",
"title": "Not Authorized",
"detail": "Not Authorized"
}
Am I understanding this incorrectly? I mean, do I need to get access to public resources as well?
@swaminathanvasanth @rraks, could you take a quick look please?
Hi @deep-gabani
For public resource, please obtain a public access token using the following API
Endpoint
https://authorization.iudx.org.in/auth/v1/token
Body
{
"itemId": "rs.iudx.org.in",
"itemType": "resource_server",
"role": "consumer"
}
Make sure to pass the clientId and clientSecret in header parameters. For more info please follow the API Documentation here
Once passed, you will get a token which shall be used to get data from the resource server.
To get the data from the resource server, pass the token obtained through the above step as a header parameter "token" along with the specific query.
To know more about the queries and parameters to be passed to the resource server, please follow the API documentation here
Lifesaver!
I was passing the auth token in Postman's Authorization (Bearer token).
Now realized, it is clearly mentioned in documentation to pass the token in the header.
Thank you @swaminathanvasanth 🙌