Class: Auth0Client
Instance Method Summary collapse
- #get_connections ⇒ Object
-
#initialize(options) ⇒ Auth0Client
constructor
A new instance of Auth0Client.
Constructor Details
#initialize(options) ⇒ Auth0Client
Returns a new instance of Auth0Client.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/auth0/client.rb', line 7 def initialize() self.class.base_uri "https://#{options[:namespace]}" token_reponse = self.class.post("/oauth/token", { body: { 'client_id' => [:client_id], 'client_secret' => [:client_secret], 'grant_type' => 'client_credentials' } }) unless token_reponse.code == 200 raise "Error geting the token: #{token_reponse.body}" end @token = token_reponse["access_token"] @headers = { "Authorization" => "Bearer #{@token}" } end |
Instance Method Details
#get_connections ⇒ Object
28 29 30 31 |
# File 'lib/auth0/client.rb', line 28 def get_connections response = self.class.get("/api/connections", { headers: @headers }) response.body end |