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

# useExternalAuth

<Note>
  ### This is an enterprise-only feature. Please contact us if you are interested.
</Note>

<Note>
  You must update your SDK version to v3.0.0-alpha.6 or above for this feature
</Note>

### Summary

This hook provides a way for clients to sign-in to Dynamic or link with Dynamic using a third-party issued JWT auth token.

The hook needs to be initialized within a child of [DynamicContextProvider](/react-sdk/providers/dynamiccontextprovider).

### Usage

Available methods:

* `signInWithExternalJwt`: Sign in to Dynamic by providing the external user ID and JWT. This will automatically set the logged-in Dynamic `user` when successful.
* `verifyWithExternalJwt`: Verify and link an external user in Dynamic by providing the external user ID and JWT.

### Usage

```TypeScript
const { signInWithExternalJwt, verifyWithExternalJwt } = useExternalAuth();

try {
  // `externalUserId`: User ID in the external auth system
  // `externalJwt`: Raw encoded JWT issued by external auth system
  const userProfile = await signInWithExternalJwt({
    externalUserId,
    externalJwt
  });

  if (userProfile) {
    // You should be logged in at this point
  }
} catch (e: any) {
  console.error('Dynamic login failed:', e);
}

try {
  const verifiedProfile = await verifyWithExternalJwt({
    externalUserId,
    externalJwt
  });

  if (verifiedProfile) {
    // User verification successful
  }
} catch (e: any) {
  console.error('Dynamic verification failed:', e);
}
```

### Details

In order to use this hook, the proper [Third-Party Auth](/authentication-methods/third-party-auth) settings need to be configured.
