Module: Auth0::Api::AuthenticationEndpoints
- Defined in:
- lib/auth0/api/authentication_endpoints.rb
Overview
https://auth0.com/docs/auth-api Describing functionality of auth0 authentication endpoints
Instance Method Summary collapse
- #change_password(email, password, connection_name = "Username-Password-Authentication") ⇒ Object
- #delegation(id_token, target, scope = "openid", api_type = "app", extra_parameters = {}) ⇒ Object
- #impersonate(user_id, app_client_id, impersonator_id, options) ⇒ Object
- #login(username, password, scope = "openid", id_token = nil, connection_name = "Username-Password-Authentication") ⇒ Object
- #obtain_access_token ⇒ Object
- #signup(email, password, connection_name = "Username-Password-Authentication") ⇒ Object
- #token_info(id_token) ⇒ Object
Instance Method Details
#change_password(email, password, connection_name = "Username-Password-Authentication") ⇒ Object
72 73 74 75 76 77 78 79 80 |
# File 'lib/auth0/api/authentication_endpoints.rb', line 72 def change_password(email, password, connection_name = "Username-Password-Authentication") request_params = { client_id: @client_id, email: email, connection: connection_name, password: password } post("/dbconnections/change_password", request_params) end |
#delegation(id_token, target, scope = "openid", api_type = "app", extra_parameters = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/auth0/api/authentication_endpoints.rb', line 17 def delegation(id_token, target, scope = "openid", api_type = "app", extra_parameters = {}) request_params = { client_id: @client_id, grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer", id_token: id_token, target: target, api_type: api_type, scope: scope }.merge(extra_parameters) post("/delegation", request_params) end |
#impersonate(user_id, app_client_id, impersonator_id, options) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/auth0/api/authentication_endpoints.rb', line 30 def impersonate(user_id, app_client_id, impersonator_id, ) request_params = { protocol: .fetch(:protocol, "oauth2"), impersonator_id: impersonator_id, client_id: app_client_id, ttl: .fetch(:ttl, 120), additionalParameters: { response_type: .fetch(:response_type, "code"), state: .fetch(:state, ""), scope: .fetch(:scope, "openid"), callback_url: .fetch(:callback_url, ""), } } post("/users/#{user_id}/impersonate", request_params) end |
#login(username, password, scope = "openid", id_token = nil, connection_name = "Username-Password-Authentication") ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/auth0/api/authentication_endpoints.rb', line 47 def login(username, password, scope = "openid", id_token=nil, connection_name="Username-Password-Authentication") request_params = { client_id: @client_id, username: username, password: password, scope: scope, connection: connection_name, grant_type: "password", id_token: id_token } post("/oauth/ro", request_params) end |
#obtain_access_token ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/auth0/api/authentication_endpoints.rb', line 7 def obtain_access_token request_params = { client_id: @client_id, client_secret: @client_secret, grant_type: 'client_credentials' } post("/oauth/token", request_params)["access_token"] end |
#signup(email, password, connection_name = "Username-Password-Authentication") ⇒ Object
61 62 63 64 65 66 67 68 69 |
# File 'lib/auth0/api/authentication_endpoints.rb', line 61 def signup(email, password, connection_name= "Username-Password-Authentication") request_params = { client_id: @client_id, email: email, connection: connection_name, password: password } post("/dbconnections/signup", request_params) end |
#token_info(id_token) ⇒ Object
83 84 85 86 |
# File 'lib/auth0/api/authentication_endpoints.rb', line 83 def token_info(id_token) request_params = { id_token: id_token} post("/tokeninfo", request_params) end |