> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Authenticate with an External JWT

> Sign users into Dynamic with a JWT issued by your own authentication provider (Bring Your Own Auth).

> [!NOTE]
>
> Bring Your Own Auth is an enterprise feature. Contact us [in Slack](https://dynamic.xyz/slack) or at [dynamic@fireblocks.com](mailto:dynamic@fireblocks.com) to enable it.

If your app already has an authentication system or uses a provider like Auth0, Firebase Auth, or Supabase, you can exchange the JWT that system issues for a Dynamic session. Dynamic verifies the token, creates or matches a user record, and returns its standard session. For concepts, JWT requirements, and console configuration, see [Bring Your Own Auth](https://docs.dynamic.xyz/docs/auth/bring-your-own-auth.md).

## Prerequisites

* Dynamic Flutter SDK initialized (see [Quickstart](https://docs.dynamic.xyz/docs/flutter/quickstart.md))
* Bring Your Own Auth enabled and configured in the [Dynamic Console](https://console.dynamic.xyz) (issuer, JWKS URL, and optionally audience and cookie name)
* Your backend issues a JWT with at least `iss`, `sub`, and `exp` claims

## Sign in

Call `signInWithExternalJwt` with the JWT issued by your auth provider and the user's ID in your system, which corresponds to the JWT's `sub` claim.

```dart theme={"system"}
try {
  await DynamicSDK.instance.auth.externalAuth.signInWithExternalJwt(
    SignInWithExternalJwtParams(
      externalJwt: jwtToken,
      externalUserId: userId,
    ),
  );
} catch (e) {
  print('External JWT sign-in failed: $e');
}
```

## Related

* [Bring Your Own Auth](https://docs.dynamic.xyz/docs/auth/bring-your-own-auth.md): concepts, configuration, and JWT requirements.
* [Session Management](https://docs.dynamic.xyz/docs/flutter/session-management.md): manage the session after sign-in.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.