Object StytchB2BClient

  • All Implemented Interfaces:

    
    public class StytchB2BClient
    
                        

    The StytchB2BClient object is your entrypoint to the Stytch B2B SDK and is how you interact with all of our supported authentication products.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      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.
      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.
      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.
      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.
      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.
      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.
      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.
      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.
      final static DeeplinkHandledStatus handle(Uri uri, Integer sessionDurationMinutes) Call this method to parse out and authenticate deeplinks that your application receives.
      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.
      final static Boolean canHandle(Uri uri) A helper function for determining whether the deeplink is intended for Stytch.
      final static PKCECodePair getPKCECodePair() Retrieve the most recently created PKCE code pair from the device, if available
      final static DeeplinkTokenPair parseDeeplink(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 B2BMagicLinks getMagicLinks() Exposes an instance of the B2BMagicLinks interface whicih provides methods for sending and authenticating users with Email Magic Links.
      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).
      final static Organization getOrganization() Exposes an instance of the Organization interface which provides methods for retrieving the current authenticated user's organization.
      final static Member getMember() Exposes an instance of the Member interface which provides methods for retrieving the current authenticated user.
      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
      final static Discovery getDiscovery() Exposes an instance of the Discovery interface which provides methods for creating and discovering Organizations and exchanging sessions between organizations
      final static SSO getSso() Exposes an instance of the SSO interface which provides methods for authenticating SSO sessions
      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
      final static OTP getOtp() Exposes an instance of the OTP interface which provides a method for sending and authenticating OTP codes
      final static TOTP getTotp() Exposes an instance of the TOTP interface which provides a method for creating and authenticating TOTP codes
      final static RecoveryCodes getRecoveryCodes() Exposes an instance of the RecoveryCodes interface which provides methods for getting, rotating, and recovering recovery codes
      final static OAuth getOauth() Exposes an instance of the OAuth interface which provides a method for starting and authenticating OAuth and OAuth Discovery flows
      final static RBAC getRbac() Exposes an instance of the RBAC interface which provides methods for checking a member's permissions
      final static SearchManager getSearchManager() Exposes an instance of the SearchManager interface which provides methods to search organizations and members
      final static SCIM getScim() Exposes an instance of the SCIM interface which provides methods for creating, getting, updating, deleting, and rotating SCIM connections
      final static B2BAuthMethod getLastAuthMethodUsed()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • 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 app
        options - Optional options to configure the StytchClient
        callback - 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 app
        callback - 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 app
        options - 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 app
        publicToken - Available via the Stytch dashboard in the API keys section
        callback - 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 app
        publicToken - Available via the Stytch dashboard in the API keys section
        options - 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 app
        publicToken - 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 app
        publicToken - Available via the Stytch dashboard in the API keys section
        options - Optional options to configure the StytchB2BClient
        callback - 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:

        DeeplinkHandledStatus

      • 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 minutes
        callback - 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

      • 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

      • 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

      • 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

      • getScim

         final static SCIM getScim()

        Exposes an instance of the SCIM interface which provides methods for creating, getting, updating, deleting, and rotating SCIM connections