Interface B2BSessions

  • All Implemented Interfaces:

    
    public interface B2BSessions
    
                        

    The B2BSessions interface provides methods for authenticating, updating, or revoking sessions, and properties to retrieve the existing session token (opaque or JWT).

    • Constructor Detail

    • Method Detail

      • onChange

         abstract Unit onChange(Function1<StytchObjectInfo<B2BSessionData>, Unit> callback)

        Assign a callback that will be called when the session data changes

      • authenticate

         abstract StytchResult<SessionsAuthenticateResponseData> authenticate(B2BSessions.AuthParams authParams)

        Authenticates a Session and updates its lifetime by the specified session_duration_minutes. If the session_duration_minutes is not specified, a Session will not be extended

        Parameters:
        authParams - required to authenticate
        Returns:

        SessionsAuthenticateResponse

      • authenticate

         abstract Unit authenticate(B2BSessions.AuthParams authParams, Function1<StytchResult<SessionsAuthenticateResponseData>, Unit> callback)

        Authenticates a Session and updates its lifetime by the specified session_duration_minutes. If the session_duration_minutes is not specified, a Session will not be extended

        Parameters:
        authParams - required to authenticate
        callback - a callback that receives an SessionsAuthenticateResponse
      • authenticateCompletable

         abstract CompletableFuture<StytchResult<SessionsAuthenticateResponseData>> authenticateCompletable(B2BSessions.AuthParams authParams)

        Authenticates a Session and updates its lifetime by the specified session_duration_minutes. If the session_duration_minutes is not specified, a Session will not be extended

        Parameters:
        authParams - required to authenticate
        Returns:

        SessionsAuthenticateResponse

      • revoke

         abstract StytchResult<BasicData> revoke(B2BSessions.RevokeParams params)

        Revoke a Session and immediately invalidate all its tokens.

        Parameters:
        params - required for revoking a session
        Returns:

        BaseResponse

      • revoke

         abstract Unit revoke(B2BSessions.RevokeParams params, Function1<StytchResult<BasicData>, Unit> callback)

        Revoke a Session and immediately invalidate all its tokens.

        Parameters:
        params - required for revoking a session
        callback - a callback that receives a BaseResponse
      • updateSession

         abstract Unit updateSession(String sessionToken, String sessionJwt)

        Updates the current session with a sessionToken and sessionJwt

      • getSync

         abstract B2BSessionData getSync()

        Get session from memory without network call

        Returns:

        locally stored B2BSessionData

      • exchange

         abstract StytchResult<SessionExchangeResponseData> exchange(B2BSessions.ExchangeParameters parameters)

        Exchanges an existing session for one in a different organization

        Parameters:
        parameters - required for exchanging a session between organizations
        Returns:

        SessionExchangeResponse

      • exchange

         abstract Unit exchange(B2BSessions.ExchangeParameters parameters, Function1<StytchResult<SessionExchangeResponseData>, Unit> callback)

        Exchanges an existing session for one in a different organization

        Parameters:
        parameters - required for exchanging a session between organizations
        callback - a callback that receives a SessionExchangeResponse
        Returns:

        SessionExchangeResponse