Object StytchB2BClient
-
- All Implemented Interfaces:
public class StytchB2BClientThe StytchB2BClient object is your entrypoint to the Stytch B2B SDK and is how you interact with all of our supported authentication products.
-
-
Field Summary
Fields Modifier and Type Field Description private final static StateFlow<Boolean>isInitializedprivate final static B2BMagicLinksmagicLinksprivate final static B2BSessionssessionsprivate final static Organizationorganizationprivate final static Membermemberprivate final static Passwordspasswordsprivate final static Discoverydiscoveryprivate final static SSOssoprivate final static DFPdfpprivate final static OTPotpprivate final static TOTPtotpprivate final static RecoveryCodesrecoveryCodesprivate final static OAuthoauthprivate final static RBACrbacprivate final static SearchManagersearchManagerprivate final static SCIMscimprivate final static B2BAuthMethodlastAuthMethodUsedpublic final static StytchB2BClientINSTANCE
-
Method Summary
Modifier and Type Method Description final static Unitconfigure(Context context)This configures the API for authenticating requests and the encrypted storage helper for persisting session data across app launches. final static Unitconfigure(Context context, StytchClientOptions options, Function1<Boolean, Unit> callback)This configures the API for authenticating requests and the encrypted storage helper for persisting session data across app launches. final static Unitconfigure(Context context, Function1<Boolean, Unit> callback)This configures the API for authenticating requests and the encrypted storage helper for persisting session data across app launches. final static Unitconfigure(Context context, StytchClientOptions options)This configures the API for authenticating requests and the encrypted storage helper for persisting session data across app launches. final static Unitconfigure(Context context, String publicToken, Function1<Boolean, Unit> callback)This configures the API for authenticating requests and the encrypted storage helper for persisting session data across app launches. final static Unitconfigure(Context context, String publicToken, StytchClientOptions options)This configures the API for authenticating requests and the encrypted storage helper for persisting session data across app launches. final static Unitconfigure(Context context, String publicToken)This configures the API for authenticating requests and the encrypted storage helper for persisting session data across app launches. final static Unitconfigure(Context context, String publicToken, StytchClientOptions options, Function1<Boolean, Unit> callback)This configures the API for authenticating requests and the encrypted storage helper for persisting session data across app launches. final static DeeplinkHandledStatushandle(Uri uri, Integer sessionDurationMinutes)Call this method to parse out and authenticate deeplinks that your application receives. final static Unithandle(Uri uri, Integer sessionDurationMinutes, Function1<DeeplinkHandledStatus, Unit> callback)Call this method to parse out and authenticate deeplinks that your application receives. final static BooleancanHandle(Uri uri)A helper function for determining whether the deeplink is intended for Stytch. final static PKCECodePairgetPKCECodePair()Retrieve the most recently created PKCE code pair from the device, if available final static DeeplinkTokenPairparseDeeplink(Uri uri)Retrieve the token and a concrete token type from a deeplink final static StateFlow<Boolean>isInitialized()Exposes a flow that reports the initialization state of the SDK. final static B2BMagicLinksgetMagicLinks()Exposes an instance of the B2BMagicLinks interface whicih provides methods for sending and authenticating users with Email Magic Links. final static B2BSessionsgetSessions()Exposes an instance of the B2BSessions interface which provides methods for authenticating, updating, or revoking sessions, and properties to retrieve the existing session token (opaque or JWT). final static OrganizationgetOrganization()Exposes an instance of the Organization interface which provides methods for retrieving the current authenticated user's organization. final static MembergetMember()Exposes an instance of the Member interface which provides methods for retrieving the current authenticated user. final static PasswordsgetPasswords()Exposes an instance of the Passwords interface which provides methods for authenticating passwords, resetting passwords, and checking the strength of passwords final static DiscoverygetDiscovery()Exposes an instance of the Discovery interface which provides methods for creating and discovering Organizations and exchanging sessions between organizations final static SSOgetSso()Exposes an instance of the SSO interface which provides methods for authenticating SSO sessions final static DFPgetDfp()Exposes an instance of the DFP interface which provides a method for retrieving a dfp_telemetry_id for use in DFP lookups on your backend server final static OTPgetOtp()Exposes an instance of the OTP interface which provides a method for sending and authenticating OTP codes final static TOTPgetTotp()Exposes an instance of the TOTP interface which provides a method for creating and authenticating TOTP codes final static RecoveryCodesgetRecoveryCodes()Exposes an instance of the RecoveryCodes interface which provides methods for getting, rotating, and recovering recovery codes final static OAuthgetOauth()Exposes an instance of the OAuth interface which provides a method for starting and authenticating OAuth and OAuth Discovery flows final static RBACgetRbac()Exposes an instance of the RBAC interface which provides methods for checking a member's permissions final static SearchManagergetSearchManager()Exposes an instance of the SearchManager interface which provides methods to search organizations and members final static SCIMgetScim()Exposes an instance of the SCIM interface which provides methods for creating, getting, updating, deleting, and rotating SCIM connections final static B2BAuthMethodgetLastAuthMethodUsed()-
-
Method Detail
-
configure
final static Unit configure(Context context)
This configures the API for authenticating requests and the encrypted storage helper for persisting session data across app launches. You must call this method before making any Stytch authentication requests.
- Parameters:
context- The applicationContext of your app
-
configure
final static Unit configure(Context context, StytchClientOptions options, Function1<Boolean, Unit> callback)
This configures the API for authenticating requests and the encrypted storage helper for persisting session data across app launches. You must call this method before making any Stytch authentication requests.
- Parameters:
context- The applicationContext of your appoptions- Optional options to configure the StytchClientcallback- An optional callback that is triggered after configuration and initialization has completed
-
configure
final static Unit configure(Context context, Function1<Boolean, Unit> callback)
This configures the API for authenticating requests and the encrypted storage helper for persisting session data across app launches. You must call this method before making any Stytch authentication requests.
- Parameters:
context- The applicationContext of your appcallback- An optional callback that is triggered after configuration and initialization has completed
-
configure
final static Unit configure(Context context, StytchClientOptions options)
This configures the API for authenticating requests and the encrypted storage helper for persisting session data across app launches. You must call this method before making any Stytch authentication requests.
- Parameters:
context- The applicationContext of your appoptions- Optional options to configure the StytchClient
-
configure
final static Unit configure(Context context, String publicToken, Function1<Boolean, Unit> callback)
This configures the API for authenticating requests and the encrypted storage helper for persisting session data across app launches. You must call this method before making any Stytch authentication requests.
- Parameters:
context- The applicationContext of your apppublicToken- Available via the Stytch dashboard in the API keys sectioncallback- An optional callback that is triggered after configuration and initialization has completed
-
configure
final static Unit configure(Context context, String publicToken, StytchClientOptions options)
This configures the API for authenticating requests and the encrypted storage helper for persisting session data across app launches. You must call this method before making any Stytch authentication requests.
- Parameters:
context- The applicationContext of your apppublicToken- Available via the Stytch dashboard in the API keys sectionoptions- Optional options to configure the StytchClient
-
configure
final static Unit configure(Context context, String publicToken)
This configures the API for authenticating requests and the encrypted storage helper for persisting session data across app launches. You must call this method before making any Stytch authentication requests.
- Parameters:
context- The applicationContext of your apppublicToken- Available via the Stytch dashboard in the API keys section
-
configure
final static Unit configure(Context context, String publicToken, StytchClientOptions options, Function1<Boolean, Unit> callback)
This configures the API for authenticating requests and the encrypted storage helper for persisting session data across app launches. You must call this method before making any Stytch authentication requests.
- Parameters:
context- The applicationContext of your apppublicToken- Available via the Stytch dashboard in the API keys sectionoptions- Optional options to configure the StytchB2BClientcallback- An optional callback that is triggered after configuration and initialization has completed
-
handle
final static DeeplinkHandledStatus handle(Uri uri, Integer sessionDurationMinutes)
Call this method to parse out and authenticate deeplinks that your application receives. The currently supported deeplink types are: B2B Email Magic Links.
For B2B Email Magic Links, it will return a DeeplinkHandledStatus.Handled class containing either the authenticated response or error.
Any other link types passed to this method will return a DeeplinkHandledStatus.NotHandled class.
- Parameters:
uri- intent.sessionDurationMinutes- desired session duration in minutes- Returns:
-
handle
final static Unit handle(Uri uri, Integer sessionDurationMinutes, Function1<DeeplinkHandledStatus, Unit> callback)
Call this method to parse out and authenticate deeplinks that your application receives. The currently supported deeplink types are: B2B Email Magic Links.
For B2B Email Magic Links, it will return a DeeplinkHandledStatus.Handled class containing either the authenticated response or error.
Any other link types passed to this method will return a DeeplinkHandledStatus.NotHandled class.
- Parameters:
uri- intent.sessionDurationMinutes- desired session duration in minutescallback- A callback that receives a DeeplinkHandledStatus
-
canHandle
final static Boolean canHandle(Uri uri)
A helper function for determining whether the deeplink is intended for Stytch. Useful in contexts where your application makes use of a deeplink coordinator/manager which requires a synchronous determination of whether a given handler can handle a given URL.
- Parameters:
uri- intent.- Returns:
Boolean
-
getPKCECodePair
final static PKCECodePair getPKCECodePair()
Retrieve the most recently created PKCE code pair from the device, if available
-
parseDeeplink
final static DeeplinkTokenPair parseDeeplink(Uri uri)
Retrieve the token and a concrete token type from a deeplink
-
isInitialized
final static StateFlow<Boolean> isInitialized()
Exposes a flow that reports the initialization state of the SDK. You can use this, or the optional callback in the
configure()method, to know when the Stytch SDK has been fully initialized and is ready for use
-
getMagicLinks
final static B2BMagicLinks getMagicLinks()
Exposes an instance of the B2BMagicLinks interface whicih provides methods for sending and authenticating users with Email Magic Links.
-
getSessions
final static B2BSessions getSessions()
Exposes an instance of the B2BSessions interface which provides methods for authenticating, updating, or revoking sessions, and properties to retrieve the existing session token (opaque or JWT).
-
getOrganization
final static Organization getOrganization()
Exposes an instance of the Organization interface which provides methods for retrieving the current authenticated user's organization.
-
getMember
final static Member getMember()
Exposes an instance of the Member interface which provides methods for retrieving the current authenticated user.
-
getPasswords
final static Passwords getPasswords()
Exposes an instance of the Passwords interface which provides methods for authenticating passwords, resetting passwords, and checking the strength of passwords
-
getDiscovery
final static Discovery getDiscovery()
Exposes an instance of the Discovery interface which provides methods for creating and discovering Organizations and exchanging sessions between organizations
-
getSso
final static SSO getSso()
Exposes an instance of the SSO interface which provides methods for authenticating SSO sessions
-
getDfp
final static DFP getDfp()
Exposes an instance of the DFP interface which provides a method for retrieving a dfp_telemetry_id for use in DFP lookups on your backend server
-
getOtp
final static OTP getOtp()
Exposes an instance of the OTP interface which provides a method for sending and authenticating OTP codes
-
getTotp
final static TOTP getTotp()
Exposes an instance of the TOTP interface which provides a method for creating and authenticating TOTP codes
-
getRecoveryCodes
final static RecoveryCodes getRecoveryCodes()
Exposes an instance of the RecoveryCodes interface which provides methods for getting, rotating, and recovering recovery codes
-
getOauth
final static OAuth getOauth()
Exposes an instance of the OAuth interface which provides a method for starting and authenticating OAuth and OAuth Discovery flows
-
getRbac
final static RBAC getRbac()
Exposes an instance of the RBAC interface which provides methods for checking a member's permissions
-
getSearchManager
final static SearchManager getSearchManager()
Exposes an instance of the SearchManager interface which provides methods to search organizations and members
-
getScim
final static SCIM getScim()
Exposes an instance of the SCIM interface which provides methods for creating, getting, updating, deleting, and rotating SCIM connections
-
getLastAuthMethodUsed
final static B2BAuthMethod getLastAuthMethodUsed()
-
-
-
-