Skip to content

Instantly share code, notes, and snippets.

@mattlevine
Created May 23, 2019 17:46
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 mattlevine/08b4a9f967e0262fe1cf378bc26ec352 to your computer and use it in GitHub Desktop.
Save mattlevine/08b4a9f967e0262fe1cf378bc26ec352 to your computer and use it in GitHub Desktop.
OAuth2 cheat sheet

#Password In the Mura admin create a webservice and set it to OAuth2 Password and then use it's client_id and client_secret with this

http://localhost:8080/index.cfm/_api/rest/v1/{siteid}/oauth2?client_id={client_id}&client_secret={client_secret}&grant_type=password&username={username}&password={password}

#Client Credentials

http://localhost:8080/index.cfm/_api/rest/v1/{siteid}/oauth2?client_id={client_id}&client_secret={client_secret}&grant_type=client_credentials

#Implicit

redirect to login

{web_login}?response_type=token&client_id={client_id}&redirect_uri={redirecto_uri}&state={state}

User logs in and is redirected to {redirecto_uri}?token_type=bearer&expires_in={expires_in}&access_token={access_token}&state={state}

You can then reread the token info with this

http://localhost:8080/index.cfm/_api/rest/v1/{siteid}/oauth2/tokeninfo?client_id={client_id}&access_token={access_token}

#Authorization Code

  1. redirect to login

{web_login}?response_type=code&client_id={client_id}&redirect_uri={redirecto_uri}&state={state}

  1. User logs in and is redirected to {redirecto_uri}?code={code}&state={state}

  2. Get access_token with code http://localhost:8080/index.cfm/_api/rest/v1/{siteid}/oauth2/?grant_type=aauthorization_code&client_id={client_id}&client_secret={client_secret}&redirect_uri={redirect_uri}&code={code}

#Refresh Token

http://localhost:8080/index.cfm/_api/rest/v1/{siteid}/oauth2?client_id={client_id}&client_secret={client_secret}&grant_type=refresh_token&refresh_token={refresh_token}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment