Request example

The following examples are using curl command to send OAuth requests to Dispatcher Paragon Cloud server.

Public and private keys shown here should not be used in production and are only provided as an example.

We will use a pair of random ED25519 keys:
Private key: pP20r1Hmqf5NTO8Rd7Truipu5f8aR+Em47cTvWleTc8dRS2cJ20bXH2iJIjg4O28gSYj+qnuUWSey7WWlWTxPw==
Public key: HUUtnCdtG1x9oiSI4ODtvIEmI/qp7lFknsu1lpVk8T8=

The following web site can be used to generate test keys or signatures: https://ed25519.herokuapp.com

Register a device

All parameters must be url-encoded, in particular the public key.

curl https://accountdomain:7400/oauth/v1/register -k -i -X POST -d "client_id=0966a26c-a5fc-4276-9c6b-587d02aceb91" -d "client_secret=mykey" -d "client_type=printer" -d "public_key=HUUtnCdtG1x9oiSI4ODtvIEmI%2Fqp7lFknsu1lpVk8T8%3D" -d "key_type=ed25519" -d "response_type=device_code"

Response:
{"device_code":"wVgzOcLwemGJPfY_d01E3PA8H3k","expires_in":259200}

Create request signature

Generate a signature using any tool or online site above.

Query string: client_id=0966a26c-a5fc-4276-9c6b-587d02aceb91&client_secret=mykey&grant_type=device_code&device_code=wVgzOcLwemGJPfY_d01E3PA8H3k

Signature: MKS1dCmgp4rLbZ2oaQeFb9pultWjI0zU7si5lb3oLCJWH8t8jgps4LLz/isPSa5OWfQAtFB3NAu04axirmF9CA==

Obtain device token

curl https://accountdomain:7400/oauth/v1/token -k -i -X POST -H "hcp-request-signature:MKS1dCmgp4rLbZ2oaQeFb9pultWjI0zU7si5lb3oLCJWH8t8jgps4LLz/isPSa5OWfQAtFB3NAu04axirmF9CA==" -d "client_id=0966a26c-a5fc-4276-9c6b-587d02aceb91" -d "client_secret=mykey" -d "grant_type=device_code" -d "device_code=wVgzOcLwemGJPfY_d01E3PA8H3k"

Response:
{"error":"authorization_pending","error_description":"Authorization pending"}