Skip to main content
“Sign in with boat” works like “Sign in with GitHub”. Your product can use another person’s boat account. The person signs in to boat, sees what your product asks for, and selects what it gets. Your product never sees a password or an API key. For your own account, use an API key.

1. Create your OAuth app

An OAuth app is the client ID and the client secret of your product.
boat prints the client ID and the client secret. It shows the secret once. You can also use OAuth apps in the dashboard. A product on a device calls boat directly. A web product calls boat from its server: boat does not answer browser requests from another site.

2. Send the person to boat

Make a random code_verifier and its SHA-256 hash, the code_challenge (PKCE). Keep the verifier.
Open this URL in the person’s browser:
boat sends the browser back to your redirect URI. Check that state is the value you sent.

3. Get the tokens

The code works once, for 5 minutes.
An OAuth app without a secret leaves client_secret out.

4. Call the API

Use the access token like an API key:
A call outside what the person allowed returns 403. Read scope errors.

5. Refresh

The access token lasts 1 hour. Then:
Each refresh returns a new refresh token. Save it and drop the old one. The old access token stops at once.If boat sees an old refresh token again after 1 minute, it disconnects your product from that account.
If the answer is lost, send the same request again within 1 minute. Refresh from one place at a time. Two workers that refresh the same connection in parallel end it. The same applies to the code: exchange it once.

Scopes

Ask for the smallest set. The person sees each one. Each scope stands alone: no scope includes another, except that sandbox.delete covers sandbox.delete-own. environment.read with exec or with environment.write also reads environment secrets. boat then adds environment.values.read to the request, shows it to the person, and returns it in scope. Your product can never create API keys, change sign-in methods or delete the account. The person can also limit your product:

Manage OAuth apps

These commands need a browser login (boat login), not an API key.
  • Disconnect stops the tokens of the product at once.
  • Delete disconnects every user of your product.
  • Your product can also give up its own access: curl -sS https://boat.dev/api/boat/oauth2/revoke -d token="$REFRESH_TOKEN"

Reference

Token errors are {"error": "...", "error_description": "..."}: Limits: 10 OAuth apps per account, 10 redirect URIs per OAuth app. boat matches the redirect URI exactly, except the port of a localhost URI. An OAuth app name cannot contain “boat”. Keep the client secret and the refresh tokens on your server. Never put a token in a URL or a log.