Skip to Content
DocumentationAdmin Back-officeSigninStep 3: Redirect to sign in

Step 3: Redirect to sign in

⏱ 5 min

Sign-in uses a full-page redirect to Transcodes Auth (tc_mode=signin), not an embedded modal.


Start sign-in

// Uses default callback on current origin (recommended) transcodes.redirectToSignIn(); // Or explicit callback URL transcodes.redirectToSignIn({ redirectUri: 'https://app.example.com/auth/callback', });

The SDK calls POST /auth/temp-session/signin/session, then navigates to the auth URL.


Handle the callback

On your callback route (or app root if ?sid= lands there), run once on load:

const result = await transcodes.handleSignInCallback(); if (result?.success) { const { token, member } = result.payload[0]; console.log('Signed in:', member.email); }

handleSignInCallback:

  1. Reads ?sid= from the URL (or postMessage from auth host)
  2. Exchanges sid for JWT via POST /auth/temp-session/signin/token
  3. Stores the session and emits AUTH_STATE_CHANGED

When no ?sid= is present, there is no session change. The method still resolves to { success: false, error: 'Authentication cancelled by user' } — safe on every page load; only act when result.success === true.

Register the callback URL in Console project settings. Mismatch causes redirect failures.

Next: Step 4: Auth state events

Last updated on