Stytch and Unit
With Unit as a banking provider in your app, you'll be required to use the customer token mechanism for certain card related user actions. Creating a customer token requires the end user to complete a two factor authentication. If you are using Stytch as your authentication provider, you will be able to complete this two factor authentication challenge via Stytch, and pass the Stytch JWT into Unit's API.
In this guide you will configure Stytch JWT information in your Unit application and pass Stytch JWTs to Unit to prove user authentication.
Check out the Stytch integration information in the Unit documentation.
Step 1: Configure your Stytch JWKs path on the Unit dashboard
In the Unit dashboard, under Org Settings > JWT Settings, ensure that "Stytch" is selected under Provider, and add your Stytch JWKs URL to the JWKs Path field:
Your project ID can be found in the Stytch Dashboard under API Keys. You should use the Test environment for any pre-production integration and testing.
Integrate Stytch authentication into your Unit flows
Step 2: Include jwtSubject in your Unit Applications
When you create an Application for a new user in Unit, the Application object must include the Stytch user_id in the jwtSubject field.
- Sign up user via a Stytch API or SDK flow - here's an example of how to get started with a sign up flow using email magic links.
- Recieve Stytch user_id from session or API response.
- Pass Stytch user_id into the user Application via Unit's APIs, using one of these options:
Step 3: Create a customer token on a card related action
See Unit's docs for this step here.
- Step up user with a second factor of authentication using a Stytch API or SDK flow - here's an example of how to get started with 2FA using Authenticator App.
- Upon successful 2FA, pass the returned/cached Stytch JWT into the Unit customers/token API (as seen in Unit's docs linked above).
- The Unit API will return a customerBearerToken that can then be used to perform sensitive Unit actions.
You just finished all the critical components to integrate your Stytch authentication with Unit's banking APIs. Have any feedback or questions? Get in touch with us in our developer forum, email@example.com, or in our Slack community.