Last active
September 4, 2018 18:09
-
-
Save lapinek/7fc688918c51070d2c6a7ab2dc22a9c7 to your computer and use it in GitHub Desktop.
AM 6.0 OAuth 2.0 public "pkce" client requesting access token with cURL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
authz_code=$(curl -s -w "%{redirect_url}" 'http://am-service.sample.svc.cluster.local/openam/oauth2/authorize?response_type=code&client_id=pkce&redirect_uri=http://localhost:9999&scope=openid&code_challenge=code_verifier' \ | |
-H 'Cookie: iPlanetDirectoryPro='$(curl -s 'http://am-service.sample.svc.cluster.local/openam/json/realms/root/authenticate' \ | |
-X POST \ | |
-H 'X-OpenAM-Username:amadmin' \ | |
-H 'X-OpenAM-Password:password' \ | |
| sed -e 's/^.*"tokenId":"\([^"]*\)".*$/\1/') \ | |
| sed 's/^.*?code=\([^&]*\).*$/\1/') \ | |
&& curl 'http://am-service.sample.svc.cluster.local:80/openam/oauth2/access_token' \ | |
-X POST \ | |
--data 'client_id=pkce&redirect_uri=http://localhost:9999&grant_type=authorization_code&code='$authz_code \ | |
-H 'Content-Type: application/x-www-form-urlencoded' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment