Files
x-stake/app/services/auth/auth0_client.rb
2021-08-04 18:49:11 -03:00

21 lines
481 B
Ruby

# frozen_string_literal: true
module Auth
class Auth0Client
class << self
def find_profile(token)
Profile.new(user_profile_attributes(token))
end
def user_profile_attributes(token)
HTTParty.get(
"https://#{ENV["AUTH_DOMAIN"]}/userinfo",
headers: {
"Content-Type" => "application/json",
"Authorization": "Bearer #{token}",
}
).with_indifferent_access
end
end
end
end