Connect with OAuth
Ask a creator for access with OAuth 2.1 and PKCE, and get a token for the Linky Hub API.
Linky Hub's authorization server is at https://linkyhub.net/atlas. Point your OAuth library at its discovery document rather than hard-coding paths:
GET $LINKHUB_URL/atlas/.well-known/openid-configuration1. Send the creator to authorize
Use the authorization code flow with PKCE (S256). Ask for openid plus the scopes you need, and name the Linky Hub API as the resource:
$LINKHUB_URL/atlas/oauth2/authorize
?response_type=code
&client_id=YOUR_CLIENT_ID
&redirect_uri=https://yourapp.example/callback
&scope=openid%20products:read%20inventory:write
&resource=urn:linkhub:api
&state=RANDOM
&code_challenge=BASE64URL_SHA256_OF_VERIFIER
&code_challenge_method=S256The creator signs in to Linky Hub and sees a consent page listing every scope in plain words. They can untick any scope except openid. Read the scope of the token you get back; never assume you got everything you asked for.
2. Exchange the code
curl -X POST "$LINKHUB_URL/atlas/oauth2/token" \
-d grant_type=authorization_code \
-d code=THE_CODE \
-d redirect_uri=https://yourapp.example/callback \
-d client_id=YOUR_CLIENT_ID \
-d client_secret=YOUR_CLIENT_SECRET \
-d code_verifier=THE_VERIFIER \
-d resource=urn:linkhub:apiThe access token is a JWT for the audience urn:linkhub:api and lasts an hour. Ask for offline_access too if you need a refresh token.
3. Refresh
curl -X POST "$LINKHUB_URL/atlas/oauth2/token" \
-d grant_type=refresh_token \
-d refresh_token=THE_REFRESH_TOKEN \
-d client_id=YOUR_CLIENT_ID \
-d client_secret=YOUR_CLIENT_SECRETDo not treat a 401 from the API as fatal: refresh once and retry.
4. Revoke
When the creator disconnects inside your app, revoke the refresh token at the revocation_endpoint from discovery. Creators can also disconnect your app from Apps in their Linky Hub dashboard; your tokens then stop working at once.
Apps with no browser
Devices and command-line tools use the device authorization grant (RFC 8628) at the device_authorization_endpoint from discovery.