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.
signInWithExternalJwt: Sign in to Dynamic by providing the external user ID and JWT. This will automatically set the logged-in Dynamic user when successful.
const { signInWithExternalJwt } = 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);}