Skip to content

Instantly share code, notes, and snippets.

@rwehresmann
Created May 12, 2019 16:54
Show Gist options
  • Select an option

  • Save rwehresmann/7091c0c635811bbad079802cd7b17c93 to your computer and use it in GitHub Desktop.

Select an option

Save rwehresmann/7091c0c635811bbad079802cd7b17c93 to your computer and use it in GitHub Desktop.
module Auth0
class Signin
def self.perform(email, password)
ctx = OpenSSL::SSL::SSLContext.new
ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE
HTTP.headers(accept: 'application/json')
.post(
"https://#{ENV['AUTH0_DOMAIN']}/oauth/token",
ssl_context: ctx,
json: {
grant_type: 'password',
username: email,
password: password,
scope: 'openid',
audience: ENV['AUTH0_AUDIENCE'],
client_id: ENV['AUTH0_CLIENT_ID'],
client_secret: ENV['AUTH0_CLIENT_SECRET'],
}
)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment