Skip to content

PollDeviceAuthorization

POST
/hopbox.v1.AuthService/PollDeviceAuthorization
curl --request POST \
--url https://example.com/hopbox.v1.AuthService/PollDeviceAuthorization \
--header 'Connect-Protocol-Version: 1' \
--header 'Connect-Timeout-Ms: 1000' \
--header 'Content-Type: application/json' \
--data '{ "deviceCode": "example" }'

PollDeviceAuthorization asks whether a person approved the device code. The first poll after the approval returns the CLI tokens, once.

Connect-Protocol-Version
Connect-Protocol-Version

Define the version of the Connect protocol

number
Allowed value: 1

Define the version of the Connect protocol

Example

1
Connect-Timeout-Ms
Connect-Timeout-Ms

Define the timeout, in ms

number

Define the timeout, in ms

Example

1000
Media typeapplication/json
PollDeviceAuthorizationRequest

PollDeviceAuthorizationRequest holds the device code.

object
deviceCode
device_code

Device_code is the device_code of StartDeviceAuthorizationResponse.

string

Example generated

{
"deviceCode": "example"
}

Success

Media typeapplication/json
PollDeviceAuthorizationResponse

PollDeviceAuthorizationResponse is the answer of a poll.

object
state
state
string
Allowed values: DEVICE_AUTHORIZATION_STATE_UNSPECIFIED DEVICE_AUTHORIZATION_STATE_PENDING DEVICE_AUTHORIZATION_STATE_SLOW_DOWN DEVICE_AUTHORIZATION_STATE_APPROVED
intervalSeconds
interval_seconds

Interval_seconds is the least time until the next poll.

integer format: int32
tokens
tokens

Tokens are set for DEVICE_AUTHORIZATION_STATE_APPROVED only.

object
accessToken
access_token

Access_token starts with hbxat_. It goes in the header “Authorization: Bearer ”.

string
accessTokenExpireTime
access_token_expire_time

Access_token_expire_time is the end of the access token, 1 hour after its issue.

string format: date-time
refreshToken
refresh_token

Refresh_token starts with hbxrt_. It works once, with RefreshCLIToken.

string
refreshTokenExpireTime
refresh_token_expire_time

Refresh_token_expire_time is the end of the refresh token, 30 days after its issue.

string format: date-time
accountId
account_id

Account_id is the UUID of the account of the tokens.

string
cliSignInId
cli_sign_in_id

Cli_sign_in_id is the UUID of the CLI sign-in. Every refresh keeps it.

string

Example

{
"state": "DEVICE_AUTHORIZATION_STATE_UNSPECIFIED",
"tokens": {
"accessTokenExpireTime": "2023-01-15T01:30:15.01Z",
"refreshTokenExpireTime": "2023-01-15T01:30:15.01Z"
}
}

Error

Media typeapplication/json
Connect Error
object
code

The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].

string
Allowed values: canceled unknown invalid_argument deadline_exceeded not_found already_exists permission_denied resource_exhausted failed_precondition aborted out_of_range unimplemented internal unavailable data_loss unauthenticated
message

A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.

string
details

A list of messages that carry the error details. There is no limit on the number of messages.

Array<object>

Contains an arbitrary serialized message along with a @type that describes the type of the serialized message, with an additional debug field for ConnectRPC error details.

object
type

A URL that acts as a globally unique identifier for the type of the serialized message. For example: type.googleapis.com/google.rpc.ErrorInfo.

string
value

The Protobuf message, serialized as bytes and base64-encoded. The specific message type is identified by the type field.

string format: byte
debug
Debug

Deserialized error detail payload. The ‘type’ field indicates the schema. This field is for easier debugging and should not be relied upon for application logic.

object
key
additional properties
any
key
additional properties
any
key
additional properties
any

Example

{
"code": "canceled"
}