Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
require 'openid_connect'
config =! ''
client =
identifier: '2940bc16-983c-41ca-b373-4c6045278627', # Native App's client_id
redirect_uri: 'custom-schema://foobar',
authorization_endpoint: config.authorization_endpoint,
token_endpoint: config.token_endpoint,
userinfo_endpoint: config.userinfo_endpoint
authorization_uri = client.authorization_uri(
scope: [:openid, :email, :profile]
puts authorization_uri
`open "#{authorization_uri}"`
code = gets.chop!
client.authorization_code = code
token = client.access_token! # aud = urn:microsoft:userinfo
client.refresh_token = token.refresh_token
token2 = client.access_token!(
resource: '' # Native App Backend's identifier
) # aud =
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment