Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Verify user identity

Confirm that the user who completed the OAuth consent is the same user your app intended to connect.

User verification applies to OAuth-based connectors only. For API key, basic auth, and key pair connectors, the user provides credentials directly. No OAuth flow, no verification step needed.

For OAuth connectors, before activating a connected account, Scalekit confirms that the user who completed the OAuth consent is the same user your app intended to connect. This user verification step runs every time a connected account is authorized and prevents OAuth consent from activating on the wrong account.

Choose a mode in Agent Auth > User Verification:

  • Custom user verification: Your server confirms the authorizing user matches the user your app intended to connect. Use in production. Without this, any user who receives an authorization link can activate a connected account (including the wrong one).
  • Scalekit users only: Scalekit checks that the authorizing user is signed in to your Scalekit dashboard. No code required. Use during development and internal testing when all users are already on your team.

AgentKit User Verification showing Custom user verifier and Scalekit users only

Your application implements the verify step. End users never interact with Scalekit directly.

When the user finishes OAuth, Scalekit redirects to your verify URL with auth_request_id and state params. Your route reads the user from your session, calls Scalekit’s verify API with the auth_request_id and the original identifier, and if they match, the connected account activates.

Review the verification sequence Connected account user verificationYour appScalekitProviderEnd user POST magic link(identifier, user_verify_url, state) Magic link URL Deliver link(email, in-app, …) Open magic link OAuth consent screen Authorization code Store tokens(pending verification) Redirect to user_verify_url(auth_request_id, state) GET /user/verify(?auth_request_id, state) Validate state,read user from session POST verify(auth_request_id, identifier) Match identifier,activate connection post_user_verify_redirect_url Redirect to your app

If you haven’t installed the SDK yet, see the quickstart.

Pass these fields when creating the authorization link:

FieldDescription
identifierRequired. Your user’s ID or email. Scalekit stores this and checks it matches at verify time.
user_verify_urlRequired. Your callback URL; Scalekit redirects the user here after OAuth completes.
stateRecommended. A random value to prevent CSRF.
import secrets
# Generate a state value to prevent CSRF
state = secrets.token_urlsafe(32)
# Store state in a secure, HTTP-only cookie to validate on callback
response = scalekit_client.actions.get_authorization_link(
connection_name=connector,
identifier=user_id,
user_verify_url="https://app.yourapp.com/user/verify",
state=state,
)

After OAuth completes, Scalekit redirects to your user_verify_url:

GET https://app.yourapp.com/user/verify?auth_request_id=req_xyz&state=<your_state>

Validate state against your cookie, then call Scalekit’s verify endpoint server-side.

# 1. Validate state from query param matches state in cookie
# 2. Read user identity from your session, not from the URL
response = scalekit_client.actions.verify_connected_account_user(
auth_request_id=auth_request_id,
identifier=user_id, # must match what was stored at link creation
)
# On success: redirect to response.post_user_verify_redirect_url

On success, the connected account is activated. Redirect the user using post_user_verify_redirect_url.