GraphQL persisted queries - Access token for 3rd Party Application with OAuth Client
I'm trying to generate an access token, so i can GET persisted queries results from a 3rd party java application.
To test this access, i'm doing the following steps:
1- Create a local user on https://<author instance>/
ex: camel-integration
2- Allow jcr:read permissions form created user at "/" path
3- Login with local user
4- Register OAuth Client
https://<author instance>/libs/granite/oauth/content/clients.html
5- Download Private Key as store.p12
6- Extract private key
openssl pkcs12 -in store.p12 -passin pass:notasecret -nocerts -nodes -out store.private.key.txt7- Generate a JWT Token:
Header
{
"alg":"RS256",
"typ":"JWT"
}
Payload
{
"aud":"https://<author instance>/oauth/token",
"iss":"<Client Id of the OAuth Client created at step 3>",
"sub":"<local user name created at step 1>",
"exp":"<Current time in milliseconds + expiry>",
"iat":"<Current time in milliseconds>",
"scope":"profile",
"cty":"code"
}
Signature
<Extracted private key at step 5>,
<Extracted private key at step 5>
8- Retrieve token from AEM
curl -H "Content-Type:application/x-www-form-urlencoded" -d "assertion=<JWT token from step 6>&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&redirect_uri=<redirect URI from step 3>&client_id=<client id from step 3>&client_secret=<client secret from step 3>" https://<author instance>/oauth/token9- Test access
curl -H "Authorization:Bearer <token from step 7>" https://<author instance>/libs/oauth/profile
I have succeeded on my local environment, but getting 401 error code on a cloud dev environment.
Does any one knows why?