Skip to navigation

Verify a previous device grant request

View as Markdown

Verify a previous device grant request and return an authorization token.

After initiating a device grant flow with /sso_device_grant, use this endpoint to check if the user has completed the verification process. If successful, it returns an access token that can be used for subsequent API calls.

This endpoint can be called multiple times until either:

  • The user completes the verification (returns 200 OK with token)
  • The timeout is reached (returns error)
  • The verification is cancelled (returns error)

Example

curl -X POST https://your-ocient-instance/v1/sso_device_grant_verify \
-H "Content-Type: application/json" \
-d '{
"user_code": "BCDFGHJK",
"timeout": 60,
"database": "retail_analytics"
}'

Request

This endpoint expects an object.
user_codestringRequired
The user code returned from a previous device grant request. This is the code that was displayed to the user and entered on the verification URI.
databasestringOptional

Target database name (defaults to system if not specified)

timeoutintegerOptional1-600Defaults to 30

Verification timeout in seconds. This is how long the server will wait for the user to complete the device authorization flow before returning a timeout error.

The valid range is 1-600 seconds (10 minutes maximum).

Response

Token exchange successful
access_tokenstring

Access token for subsequent API calls. This token should be included in the Authorization header for all authenticated requests using the format: Authorization: Bearer {token}.

statusobjectRead-only
Status information about the login operation. A successful login will have a SQL state of "00000".
usernamestringOptional
The authenticated user's username. This is useful for displaying in UIs or for audit logging purposes.
databasestringOptional
The database that was authenticated against. This is the default database for subsequent queries if none is specified.
expires_inintegerOptional
Number of seconds until the access token expires. Clients should refresh the token before this time to maintain uninterrupted access.

Errors

401
Unauthorized Error