Skip to Content
Potik Docs
Runbooks

Mobile sign-in with ZITADEL

Create a native OIDC client in the same ZITADEL project as the API. Register an exact callback URI owned by the app, prefer a verified HTTPS application link, and use authorization code with PKCE S256. Configure JWT access tokens and request the API project audience. Keep the native client public.

  1. Use the system browser and the platform's OIDC library to start the flow. Generate a fresh verifier, state and nonce for every attempt.
  2. Validate the callback with the library and exchange the code with the original verifier. Request the scope urn:zitadel:iam:org:project:id:<api-project-id>:aud and urn:zitadel:iam:org:project:id:<api-project-id>:roles along with openid.
  3. Send the access token as Authorization: Bearer <token> to GET /me and POST /graphql. Use the stable application ID returned by /me.
  4. Keep credentials in OS-protected storage. On sign-out clear local credentials and revoke refresh tokens when issued. Reauthenticate after token expiry or failed refresh.

Use a different client registration for the browser BFF. Treat the API audience as a resource identifier separate from either client ID.