Exchange Firebase Phone Number Verification token
Exchange a Firebase Phone Number Verification (PNV) JWT for a Cowdi custom token. **Flow:** 1. Client completes phone verification via Firebase PNV SDK 2. Send the PNV JWT to this endpoint 3. Receive a Cowdi custom token (one-time use) 4. Sign in with the custom token via `/v1/auth/sign-in` to obtain ID + refresh tokens The PNV token's `sub` claim must contain the verified E.164 phone number. If a Cowdi user with that phone exists, they are signed in. Otherwise a new user is provisioned on the waiting list.
curl -X POST "https://example.com/v1/auth/public/exchange/phone" \ -H "Content-Type: application/json" \ -d '{ "phone_verification_token": "string" }'{ "access_token": "string", "token_type": "string", "expires_in": 0}{ "code": "BAD_REQUEST", "description": "Invalid input"}Exchange Partner JWT POST
Exchange a partner JWT for a local JWT token that can be used to access protected endpoints. **Partner Integration Guide:** 1. Obtain a valid JWT from your partner token issuer 2. Send the partner token in the request body 3. Receive a local JWT token in response 4. Use the local JWT token in Authorization header for subsequent API calls **Error Troubleshooting:** - `INVALID_TOKEN`: Token format or content is invalid - `TOKEN_EXPIRED`: Partner token has expired - `INVALID_TOKEN_SIGNATURE`: Token signature verification failed - `UNKNOWN_TOKEN_ISSUER`: Organization issuer is not recognized - `MALFORMED_TOKEN`: Token structure is malformed - `INVALID_TOKEN_CLAIMS`: Required token claims are missing or invalid
Refresh Token POST
Refresh an expired or expiring ID token using a refresh token. **Token Refresh Guide:** 1. Monitor ID token expiration (typically 1 hour) 2. Before expiration, call this endpoint with refresh token 3. Receive new ID token and refresh token 4. Update stored tokens with new values 5. Continue using new ID token for API calls **Best Practice:** Refresh tokens proactively before ID token expires.