Skip to content

Instantly share code, notes, and snippets.

@mygzi
Created May 20, 2019 23:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mygzi/0005b61d56a84764dd0a1b6e07fe9014 to your computer and use it in GitHub Desktop.
Save mygzi/0005b61d56a84764dd0a1b6e07fe9014 to your computer and use it in GitHub Desktop.
Generate PKCE (RFC 7636) secret and challenge on the command line
CODE_VERIFIER=`head -c 32 /dev/urandom | base64 | sed -e "s,=,,g" -e "s,+,-,g" -e "s,/,_,g"`
CODE_CHALLENGE=`echo -n $CODE_VERIFIER | openssl dgst -sha256 -binary | base64 | sed -e "s,=,,g" -e "s,+,-,g" -e "s,/,_,g"`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment