Act for a person with an OAuth app
Call the Astropods API as a signed-in person, limited to the scopes you grant
An OAuth app that acts for a person calls the Astropods API with that person’s access, capped by the scopes you grant the app. The person signs in once and approves the app. The app then holds an access token and a refresh token for them. Use one for a tool that reads an agent’s traces, logs, or evaluations on someone’s behalf.
Create the app
Creating an app requires the app:manage permission on the account, which account administrators hold.
Choose the access
Select User access. Turn on Public client for a mobile, desktop, or browser app that can’t keep a secret. A public client signs in with PKCE alone and holds no client secret.
Grant scopes
Grant deployment:read to read deployments. Scopes use the same permission names as roles.
Get a token
The app uses the OAuth 2.0 authorization code grant with PKCE.
- Send the person to
https://login.astropods.com/oauth2/authorizewith yourclient_id,redirect_uri,state, a PKCEcode_challenge, andscope=openid profile email offline_access. - The person signs in and approves the app. The browser returns to your redirect URI with a
code. - Exchange the code at
https://login.astropods.com/oauth2/tokenwith the PKCE verifier, and your client secret for a confidential app. The response holds an access token and a refresh token. - Send the access token as
Authorization: Bearer <token>. When it expires, exchange the refresh token at the same token URL.
The scope parameter carries sign-in scopes only. What the app may do comes from the scopes on the app itself, so changing them in settings applies on the next request.
Call GET /api/v1/me to check a token. For a token from an app acting for a person, it returns the person, the app and its scopes, and the app’s account while the person is still a member of it.
Read a deployment
With the deployment:read scope, the app can call the deployment endpoints that read data with GET:
The app reads only what the person can read. A deployment the person can’t see is hidden from the app too. The deployment must also belong to the account that owns the app, even when the person belongs to other accounts.
The app can’t change a deployment. Every request that isn’t a GET or HEAD on these endpoints is refused, including ones that change only the person’s own settings, such as watching a deployment’s alerts.
Errors
Revoke access
Delete the app to revoke its tokens. Every token issued for it, including tokens that haven’t expired, is refused starting with the next request. A log stream that is already open (GET /api/v1/deployments/{id}/logs/stream) continues until it disconnects. Removing the person from the account ends the app’s access to that account’s deployments the same way.
Next steps
- Access control describes each permission.
- API reference lists every endpoint and its parameters.
- Authentication covers signing in with the CLI.