Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Code that is used in the example given by Foobar's "OAUTH 2.0 EXPLAINED IN SIMPLE WORDS (Amazon Cognito)": https://www.youtube.com/watch?v=7kwqPoeEt1c
APP_ID=2kou24pdi9pagm6bawd3jb0jrd
APP_SECRET=be9noij0kc98u80asfnomjnm7ppk1pm240vvae
URL="my-test-poo.auth.eu-west-1.amazoncognito.com"
BASIC=$(echo -n $APP_ID:$APP_SECRET | base64)
AUTHENTICATE="Basic $BASIC"
echo "https://$URL/oauth2/authorize?response_type=code&client_id=$APP_ID&state=12345&redirect_uri=http://localhost&scope=aws.cognito.signin.user.admin%20email%20openid%20profile&" | pbcopy
https://my-test-pool.auth.eu-west-1.amazoncognito.com/oauth2/authorize?
response_type=code
&client_id="$APP_ID"
&state=12345
&redirect_uri=http://localhost&scope=aws.cognito.signin.user.admin%20email%20openid%20profile&
CODE=981cd9fb-618c-4282-9255-3a1bdd7f5f75
curl -X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Authorization: $AUTHENTICATE" \
--data "grant_type=authorization_code&client_id=$APP_ID&code=$CODE&redirect_uri=http://localhost" \
"https://$URL/oauth2/token"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment