Module: Descope::Api::V1::Auth::OAuth
- Included in:
- Descope::Api::V1::Auth
- Defined in:
- lib/descope/api/v1/auth/oauth.rb
Overview
Holds all the password API calls
Constant Summary
Constants included from Mixins::Common::EndpointsV2
Mixins::Common::EndpointsV2::PUBLIC_KEY_PATH
Constants included from Mixins::Common::EndpointsV1
Mixins::Common::EndpointsV1::AUTH_SAML_START_PATH, Mixins::Common::EndpointsV1::EXCHANGE_AUTH_ACCESS_KEY_PATH, Mixins::Common::EndpointsV1::GET_SESSION_ENCHANTEDLINK_AUTH_PATH, Mixins::Common::EndpointsV1::GET_SESSION_MAGICLINK_AUTH_PATH, Mixins::Common::EndpointsV1::HISTORY_PATH, Mixins::Common::EndpointsV1::LOGOUT_ALL_PATH, Mixins::Common::EndpointsV1::LOGOUT_PATH, Mixins::Common::EndpointsV1::ME_PATH, Mixins::Common::EndpointsV1::OAUTH_CREATE_REDIRECT_URL_FOR_SIGN_IN_REQUEST_PATH, Mixins::Common::EndpointsV1::OAUTH_CREATE_REDIRECT_URL_FOR_SIGN_UP_REQUEST_PATH, Mixins::Common::EndpointsV1::OAUTH_EXCHANGE_TOKEN_PATH, Mixins::Common::EndpointsV1::OAUTH_START_PATH, Mixins::Common::EndpointsV1::PASSWORD_POLICY_PATH, Mixins::Common::EndpointsV1::REFRESH_TOKEN_PATH, Mixins::Common::EndpointsV1::REPLACE_PASSWORD_PATH, Mixins::Common::EndpointsV1::SAML_EXCHANGE_TOKEN_PATH, Mixins::Common::EndpointsV1::SELECT_TENANT_PATH, Mixins::Common::EndpointsV1::SEND_RESET_PASSWORD_PATH, Mixins::Common::EndpointsV1::SIGN_IN_AUTH_ENCHANTEDLINK_PATH, Mixins::Common::EndpointsV1::SIGN_IN_AUTH_MAGICLINK_PATH, Mixins::Common::EndpointsV1::SIGN_IN_AUTH_OTP_PATH, Mixins::Common::EndpointsV1::SIGN_IN_AUTH_WEBAUTHN_FINISH_PATH, Mixins::Common::EndpointsV1::SIGN_IN_AUTH_WEBAUTHN_START_PATH, Mixins::Common::EndpointsV1::SIGN_IN_PASSWORD_PATH, Mixins::Common::EndpointsV1::SIGN_UP_AUTH_ENCHANTEDLINK_PATH, Mixins::Common::EndpointsV1::SIGN_UP_AUTH_MAGICLINK_PATH, Mixins::Common::EndpointsV1::SIGN_UP_AUTH_OTP_PATH, Mixins::Common::EndpointsV1::SIGN_UP_AUTH_TOTP_PATH, Mixins::Common::EndpointsV1::SIGN_UP_AUTH_WEBAUTHN_FINISH_PATH, Mixins::Common::EndpointsV1::SIGN_UP_AUTH_WEBAUTHN_START_PATH, Mixins::Common::EndpointsV1::SIGN_UP_OR_IN_AUTH_ENCHANTEDLINK_PATH, Mixins::Common::EndpointsV1::SIGN_UP_OR_IN_AUTH_MAGICLINK_PATH, Mixins::Common::EndpointsV1::SIGN_UP_OR_IN_AUTH_OTP_PATH, Mixins::Common::EndpointsV1::SIGN_UP_OR_IN_AUTH_WEBAUTHN_START_PATH, Mixins::Common::EndpointsV1::SIGN_UP_PASSWORD_PATH, Mixins::Common::EndpointsV1::UPDATE_AUTH_WEBAUTHN_FINISH_PATH, Mixins::Common::EndpointsV1::UPDATE_AUTH_WEBAUTHN_START_PATH, Mixins::Common::EndpointsV1::UPDATE_PASSWORD_PATH, Mixins::Common::EndpointsV1::UPDATE_TOTP_PATH, Mixins::Common::EndpointsV1::UPDATE_USER_EMAIL_ENCHANTEDLINK_PATH, Mixins::Common::EndpointsV1::UPDATE_USER_EMAIL_MAGICLINK_PATH, Mixins::Common::EndpointsV1::UPDATE_USER_EMAIL_OTP_PATH, Mixins::Common::EndpointsV1::UPDATE_USER_PHONE_MAGICLINK_PATH, Mixins::Common::EndpointsV1::UPDATE_USER_PHONE_OTP_PATH, Mixins::Common::EndpointsV1::VALIDATE_SESSION_PATH, Mixins::Common::EndpointsV1::VERIFY_CODE_AUTH_PATH, Mixins::Common::EndpointsV1::VERIFY_ENCHANTEDLINK_AUTH_PATH, Mixins::Common::EndpointsV1::VERIFY_MAGICLINK_AUTH_PATH, Mixins::Common::EndpointsV1::VERIFY_TOTP_PATH
Constants included from Mixins::Common
Mixins::Common::COOKIE_DATA_NAME, Mixins::Common::DEFAULT_BASE_URL, Mixins::Common::DEFAULT_JWT_VALIDATION_LEEWAY, Mixins::Common::DEFAULT_TIMEOUT_SECONDS, Mixins::Common::PHONE_REGEX, Mixins::Common::REDIRECT_LOCATION_COOKIE_NAME, Mixins::Common::REFRESH_SESSION_COOKIE_NAME, Mixins::Common::REFRESH_SESSION_TOKEN_NAME, Mixins::Common::SESSION_COOKIE_NAME, Mixins::Common::SESSION_TOKEN_NAME
Instance Method Summary collapse
- #oauth_create_redirect_url_for_sign_in_request(stepup: false, custom_claims: {}, mfa: false, sso_app_id: nil) ⇒ Object
- #oauth_create_redirect_url_for_sign_up_request(stepup: false, custom_claims: {}, mfa: false, sso_app_id: nil) ⇒ Object
- #oauth_exchange_token(code = nil) ⇒ Object
- #oauth_start(provider: nil, return_url: nil, prompt: nil, login_options: nil, refresh_token: nil, template_options: nil) ⇒ Object
Methods included from Mixins::Validation
#validate_code, #validate_email, #validate_login_id, #validate_password, #validate_phone, #validate_redirect_url, #validate_refresh_token_not_nil, #validate_scim_group_id, #validate_tenant, #validate_tenants, #validate_token_not_empty, #validate_user_id, #verify_provider
Methods included from Mixins::Common
#deep_copy, #get_method_string
Instance Method Details
#oauth_create_redirect_url_for_sign_in_request(stepup: false, custom_claims: {}, mfa: false, sso_app_id: nil) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/descope/api/v1/auth/oauth.rb', line 26 def oauth_create_redirect_url_for_sign_in_request(stepup: false, custom_claims: {}, mfa: false, sso_app_id: nil) request_params = { stepup:, customClaims: custom_claims, mfa:, ssoAppId: sso_app_id } post(OAUTH_CREATE_REDIRECT_URL_FOR_SIGN_IN_REQUEST_PATH, request_params) end |
#oauth_create_redirect_url_for_sign_up_request(stepup: false, custom_claims: {}, mfa: false, sso_app_id: nil) ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/descope/api/v1/auth/oauth.rb', line 37 def oauth_create_redirect_url_for_sign_up_request(stepup: false, custom_claims: {}, mfa: false, sso_app_id: nil) request_params = { stepup:, customClaims: custom_claims, mfa:, ssoAppId: sso_app_id } post(OAUTH_CREATE_REDIRECT_URL_FOR_SIGN_UP_REQUEST_PATH, request_params) end |
#oauth_exchange_token(code = nil) ⇒ Object
22 23 24 |
# File 'lib/descope/api/v1/auth/oauth.rb', line 22 def oauth_exchange_token(code = nil) exchange_token(OAUTH_EXCHANGE_TOKEN_PATH, code) end |
#oauth_start(provider: nil, return_url: nil, prompt: nil, login_options: nil, refresh_token: nil, template_options: nil) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/descope/api/v1/auth/oauth.rb', line 14 def oauth_start(provider: nil, return_url: nil, prompt: nil, login_options: nil, refresh_token: nil, template_options: nil) body = compose_start_params(login_options:, template_options:) url = "#{OAUTH_START_PATH}?provider=#{provider}" url += "&redirectUrl=#{CGI.escape(return_url)}" if return_url url += "&prompt=#{CGI.escape(prompt)}" if prompt post(url, body, {}, refresh_token) end |