Class: StytchB2B::Organizations::Members::OAuthProviders
- Inherits:
-
Object
- Object
- StytchB2B::Organizations::Members::OAuthProviders
- Includes:
- Stytch::RequestHelper
- Defined in:
- lib/stytch/b2b_organizations.rb
Instance Method Summary collapse
-
#github(organization_id:, member_id:, include_refresh_token: nil) ⇒ Object
Retrieve the saved GitHub access token for a Member.
-
#google(organization_id:, member_id:, include_refresh_token: nil) ⇒ Object
Retrieve the saved Google access token and ID token for a member.
-
#hubspot(organization_id:, member_id:, include_refresh_token: nil) ⇒ Object
Retrieve the saved Hubspot access token and ID token for a member.
-
#initialize(connection) ⇒ OAuthProviders
constructor
A new instance of OAuthProviders.
-
#microsoft(organization_id:, member_id:, include_refresh_token: nil) ⇒ Object
Retrieve the saved Microsoft access token and ID token for a member.
-
#slack(organization_id:, member_id:) ⇒ Object
Retrieve the saved Slack access token and ID token for a member.
Methods included from Stytch::RequestHelper
#delete_request, #get_request, #post_request, #put_request, #request_with_query_params
Constructor Details
#initialize(connection) ⇒ OAuthProviders
Returns a new instance of OAuthProviders.
1841 1842 1843 |
# File 'lib/stytch/b2b_organizations.rb', line 1841 def initialize(connection) @connection = connection end |
Instance Method Details
#github(organization_id:, member_id:, include_refresh_token: nil) ⇒ Object
Retrieve the saved GitHub access token for a Member. After a successful OAuth login, Stytch will save the issued access token from the identity provider. GitHub does not issue refresh tokens, but will invalidate access tokens after very long periods of inactivity.
Parameters:
- organization_id
Globally unique UUID that identifies a specific Organization. The
organization_idis critical to perform operations on an Organization, so be sure to preserve this value. You may also use the organization_slug or organization_external_id here as a convenience. The type of this field isString.- member_id
Globally unique UUID that identifies a specific Member. The
member_idis critical to perform operations on a Member, so be sure to preserve this value. You may use an external_id here if one is set for the member. The type of this field isString.- include_refresh_token
Whether to return the refresh token Stytch has stored for the OAuth Provider. Defaults to false. Important: If your application exchanges the refresh token, Stytch may not be able to automatically refresh access tokens in the future. The type of this field is nilable
Boolean.
Returns:
An object with the following fields:
- request_id
Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue. The type of this field is
String.- provider_type
Denotes the OAuth identity provider that the user has authenticated with, e.g. Google, Microsoft, GitHub etc. The type of this field is
String.- registrations
A list of tokens the member is registered with. The type of this field is list of
GithubProviderInfo(+object+).- status_code
The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors. The type of this field is
Integer.
2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 |
# File 'lib/stytch/b2b_organizations.rb', line 2071 def github( organization_id:, member_id:, include_refresh_token: nil ) headers = {} query_params = { include_refresh_token: include_refresh_token } request = request_with_query_params("/v1/b2b/organizations/#{organization_id}/members/#{member_id}/oauth_providers/github", query_params) get_request(request, headers) end |
#google(organization_id:, member_id:, include_refresh_token: nil) ⇒ Object
Retrieve the saved Google access token and ID token for a member. After a successful OAuth login, Stytch will save the issued access token and ID token from the identity provider. If a refresh token has been issued, Stytch will refresh the access token automatically.
Google One Tap does not return access tokens. If the member has only authenticated through Google One Tap and not through a regular Google OAuth flow, this endpoint will not return any tokens.
Note: Google does not issue a refresh token on every login, and refresh tokens may expire if unused.
To force a refresh token to be issued, pass the ?provider_prompt=consent query param into the
Start Google OAuth flow endpoint.
Parameters:
- organization_id
Globally unique UUID that identifies a specific Organization. The
organization_idis critical to perform operations on an Organization, so be sure to preserve this value. You may also use the organization_slug or organization_external_id here as a convenience. The type of this field isString.- member_id
Globally unique UUID that identifies a specific Member. The
member_idis critical to perform operations on a Member, so be sure to preserve this value. You may use an external_id here if one is set for the member. The type of this field isString.- include_refresh_token
Whether to return the refresh token Stytch has stored for the OAuth Provider. Defaults to false. Important: If your application exchanges the refresh token, Stytch may not be able to automatically refresh access tokens in the future. The type of this field is nilable
Boolean.
Returns:
An object with the following fields:
- request_id
Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue. The type of this field is
String.- provider_type
Denotes the OAuth identity provider that the user has authenticated with, e.g. Google, Microsoft, GitHub etc. The type of this field is
String.- provider_subject
The unique identifier for the User within a given OAuth provider. Also commonly called the
subor "Subject field" in OAuth protocols. The type of this field isString.- id_token
The
id_tokenreturned by the OAuth provider. ID Tokens are JWTs that contain structured information about a user. The exact content of each ID Token varies from provider to provider. ID Tokens are returned from OAuth providers that conform to the OpenID Connect specification, which is based on OAuth. The type of this field isString.- scopes
The OAuth scopes included for a given provider. See each provider's section above to see which scopes are included by default and how to add custom scopes. The type of this field is list of
String.- status_code
The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors. The type of this field is
Integer.- access_token
The
access_tokenthat you may use to access the User's data in the provider's API. The type of this field is nilableString.- access_token_expires_in
The number of seconds until the access token expires. The type of this field is nilable
Integer.- refresh_token
The
refresh_tokenthat you may use to obtain a newaccess_tokenfor the User within the provider's API. The type of this field is nilableString.
1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 |
# File 'lib/stytch/b2b_organizations.rb', line 1895 def google( organization_id:, member_id:, include_refresh_token: nil ) headers = {} query_params = { include_refresh_token: include_refresh_token } request = request_with_query_params("/v1/b2b/organizations/#{organization_id}/members/#{member_id}/oauth_providers/google", query_params) get_request(request, headers) end |
#hubspot(organization_id:, member_id:, include_refresh_token: nil) ⇒ Object
Retrieve the saved Hubspot access token and ID token for a member. After a successful OAuth login, Stytch will save the issued access token and ID token from the identity provider. If a refresh token has been issued, Stytch will refresh the access token automatically.
Parameters:
- organization_id
Globally unique UUID that identifies a specific Organization. The
organization_idis critical to perform operations on an Organization, so be sure to preserve this value. You may also use the organization_slug or organization_external_id here as a convenience. The type of this field isString.- member_id
Globally unique UUID that identifies a specific Member. The
member_idis critical to perform operations on a Member, so be sure to preserve this value. You may use an external_id here if one is set for the member. The type of this field isString.- include_refresh_token
Whether to return the refresh token Stytch has stored for the OAuth Provider. Defaults to false. Important: If your application exchanges the refresh token, Stytch may not be able to automatically refresh access tokens in the future. The type of this field is nilable
Boolean.
Returns:
An object with the following fields:
- request_id
Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue. The type of this field is
String.- provider_type
Denotes the OAuth identity provider that the user has authenticated with, e.g. Google, Microsoft, GitHub etc. The type of this field is
String.- registrations
A list of tokens the member is registered with. The type of this field is list of
HubspotProviderInfo(+object+).- status_code
The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors. The type of this field is
Integer.
2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 |
# File 'lib/stytch/b2b_organizations.rb', line 2029 def hubspot( organization_id:, member_id:, include_refresh_token: nil ) headers = {} query_params = { include_refresh_token: include_refresh_token } request = request_with_query_params("/v1/b2b/organizations/#{organization_id}/members/#{member_id}/oauth_providers/hubspot", query_params) get_request(request, headers) end |
#microsoft(organization_id:, member_id:, include_refresh_token: nil) ⇒ Object
Retrieve the saved Microsoft access token and ID token for a member. After a successful OAuth login, Stytch will save the issued access token and ID token from the identity provider. If a refresh token has been issued, Stytch will refresh the access token automatically.
Parameters:
- organization_id
Globally unique UUID that identifies a specific Organization. The
organization_idis critical to perform operations on an Organization, so be sure to preserve this value. You may also use the organization_slug or organization_external_id here as a convenience. The type of this field isString.- member_id
Globally unique UUID that identifies a specific Member. The
member_idis critical to perform operations on a Member, so be sure to preserve this value. You may use an external_id here if one is set for the member. The type of this field isString.- include_refresh_token
Whether to return the refresh token Stytch has stored for the OAuth Provider. Defaults to false. Important: If your application exchanges the refresh token, Stytch may not be able to automatically refresh access tokens in the future. The type of this field is nilable
Boolean.
Returns:
An object with the following fields:
- request_id
Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue. The type of this field is
String.- provider_type
Denotes the OAuth identity provider that the user has authenticated with, e.g. Google, Microsoft, GitHub etc. The type of this field is
String.- provider_subject
The unique identifier for the User within a given OAuth provider. Also commonly called the
subor "Subject field" in OAuth protocols. The type of this field isString.- access_token
The
access_tokenthat you may use to access the User's data in the provider's API. The type of this field isString.- access_token_expires_in
The number of seconds until the access token expires. The type of this field is
Integer.- id_token
The
id_tokenreturned by the OAuth provider. ID Tokens are JWTs that contain structured information about a user. The exact content of each ID Token varies from provider to provider. ID Tokens are returned from OAuth providers that conform to the OpenID Connect specification, which is based on OAuth. The type of this field isString.- scopes
The OAuth scopes included for a given provider. See each provider's section above to see which scopes are included by default and how to add custom scopes. The type of this field is list of
String.- status_code
The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors. The type of this field is
Integer.- refresh_token
The
refresh_tokenthat you may use to obtain a newaccess_tokenfor the User within the provider's API. The type of this field is nilableString.
1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 |
# File 'lib/stytch/b2b_organizations.rb', line 1952 def microsoft( organization_id:, member_id:, include_refresh_token: nil ) headers = {} query_params = { include_refresh_token: include_refresh_token } request = request_with_query_params("/v1/b2b/organizations/#{organization_id}/members/#{member_id}/oauth_providers/microsoft", query_params) get_request(request, headers) end |
#slack(organization_id:, member_id:) ⇒ Object
Retrieve the saved Slack access token and ID token for a member. After a successful OAuth login, Stytch will save the issued access token and ID token from the identity provider.
Parameters:
- organization_id
Globally unique UUID that identifies a specific Organization. The
organization_idis critical to perform operations on an Organization, so be sure to preserve this value. You may also use the organization_slug or organization_external_id here as a convenience. The type of this field isString.- member_id
Globally unique UUID that identifies a specific Member. The
member_idis critical to perform operations on a Member, so be sure to preserve this value. You may use an external_id here if one is set for the member. The type of this field isString.
Returns:
An object with the following fields:
- request_id
Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue. The type of this field is
String.- provider_type
Denotes the OAuth identity provider that the user has authenticated with, e.g. Google, Microsoft, GitHub etc. The type of this field is
String.- registrations
A list of tokens the member is registered with. The type of this field is list of
SlackProviderInfo(+object+).- status_code
The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors. The type of this field is
Integer.
1990 1991 1992 1993 1994 1995 1996 1997 1998 |
# File 'lib/stytch/b2b_organizations.rb', line 1990 def slack( organization_id:, member_id: ) headers = {} query_params = {} request = request_with_query_params("/v1/b2b/organizations/#{organization_id}/members/#{member_id}/oauth_providers/slack", query_params) get_request(request, headers) end |