Authentication
API keys, bearer tokens, and the dual-auth model
API keys, bearer tokens, and the dual-auth model
Every Vlens API request requires two credentials:
Used for service-to-service calls and management operations. Obtained by calling /api/credentials/Login with your admin credentials.
Response:
Lifetime: 24 hours. Use the refreshToken to get a new access token before it expires.
Returned by the registration and login flows. Used for all user-scoped operations (identity verification, business request creation, contract signing).
User tokens are returned in the data.accessToken field of /api/DigitalIdentity/Register and other user-facing endpoints.
Users can authenticate using an existing Google or Microsoft account. The OAuth token from the provider is verified by Vlens, and the resulting oAuthTokenVerificationRequestId is passed to /Register to skip the email verification step.
OAuth provider setup is configured in the Vlens portal. See the Google Cloud Platform Console and Azure AD B2C documentation for creating OAuth client credentials.
Some endpoints require only the ApiKey header and no bearer token. These are public registration endpoints:
POST /api/DigitalIdentity/CheckExistenceOfEmailOrPhonePOST /api/DigitalIdentity/Register/StepVerifyPhonePOST /api/DigitalIdentity/Register/StepVerifyEmailPOST /api/DigitalIdentity/Register/StepVerifyOAuthTokenPOST /api/DigitalIdentity/VerifyOAuthTokenPOST /api/DigitalIdentity/RegisterPOST /api/IdentityUserSession/CreateAuthSessionUse the refresh token to obtain a new access token without re-authenticating:
Refresh tokens are long-lived (7 days by default). Rotate them server-side and never expose them to client-side code.
A complete request with both credentials looks like this:
Vlens is multi-tenant. Your ApiKey is scoped to your tenant — you cannot access another tenant’s data. Admin tokens issued by /api/credentials/Login are also tenant-scoped.
When using the admin login endpoint, pass your TenancyName in both the request body (tenancyName field) and as a header.
ApiKey and admin credentials server-side only — never in client-side code or mobile apps.ApiKey from the dashboard if you suspect it has been compromised.