The Tasking Manager delegates authentication entirely to OpenStreetMap’s OAuth 2.0 service. When a user grants permission, the Tasking Manager backend exchanges the authorization code for an OSM access token, looks up (or creates) the user record in its database, and issues a signed session token. That session token is what you include in every subsequent API request. All write operations — creating projects, locking tasks, managing teams — and most user-specific reads require a valid token.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/hotosm/tasking-manager/llms.txt
Use this file to discover all available pages before exploring further.
OAuth 2.0 Login Flow
Register an OAuth 2 application on OpenStreetMap
Before users can log in, your Tasking Manager instance needs credentials registered with OpenStreetMap.
- Go to openstreetmap.org and sign in.
- Click your username in the top-right corner and select My Settings.
- Navigate to OAuth 2 applications → Register new application.
- Set the Redirect URI to the
/authorizedpath of your Tasking Manager frontend. For local development this is:127.0.0.1is required for local debugging — OSM does not allowlocalhostas a redirect host. - Enable the following permission scopes:
- Read user preferences (
read_prefs) - Modify the map (
write_api)
- Read user preferences (
- Save your Client ID and Client Secret, then set them in
tasking-manager.env:
Initiate the login flow
Direct the user to the Tasking Manager login endpoint. The API generates an OSM authorization URL and a CSRF state token.Response:Redirect the user’s browser to the
The URI to redirect the user to after OSM authorization. Must match the redirect URI registered with your OSM OAuth 2 application.
auth_url. OSM will present its own authorization screen where the user grants the requested scopes.Handle the OSM callback
After the user approves access, OSM redirects them back to your Response (success):Store the
redirect_uri with an authorization code in the query string. Pass that code to the Tasking Manager callback endpoint.The short-lived authorization code issued by OSM after the user grants permission. Internally aliased from the
authorization_code variable.Must match the redirect URI used in the previous step and the one registered with your OSM OAuth 2 application.
Optional. An email address to associate with the user’s Tasking Manager account for notifications.
session_token value securely. This is what you include in the Authorization header of all subsequent API requests.Error responses:| Status | SubCode | Meaning |
|---|---|---|
400 | InvalidData | The code query parameter is missing. |
400 | InvalidGrantError | The authorization code is expired, invalid, or already used. |
502 | TokenFetchError | Could not fetch an access token from OSM. |
502 | OSMServiceError | Could not retrieve user details from the OSM API. |
502 | AuthError | An internal error occurred during user login. |
Use the token in API requests
Include the session token in the The token is a base64-encoded, signed string. The
Authorization header of every request to a protected endpoint. The scheme is Token (not Bearer):TokenAuthBackend middleware validates it on every request — it decodes the base64 payload, verifies the signature using the TM_SECRET key, and checks that the token has not expired (tokens are valid for 7 days / 604 800 seconds).Getting a Token for Development or Testing
You do not always need to run the full OAuth flow. There are three shortcuts for obtaining a token during development.Option 1 — Copy the API Key from the browser UI (production or staging)
- Sign in to the Tasking Manager web application in your browser.
- Navigate to your user profile page.
- Enable Expert Mode in your account settings.
- Copy the token displayed in the API Key section.
Option 2 — Inspect a network request (production or staging)
- Open your browser’s developer tools (F12 / ⌥⌘I).
- Go to the Network tab and perform any authenticated action on the Tasking Manager.
- Click on one of the requests, open the Request Headers panel, and copy the value of the
Authorizationheader.
Option 3 — Generate a token from the command line (local development)
The Tasking Manager CLI exposes agen_token command that creates a valid signed session token for any OSM user ID:
Token Format
Tasking Manager tokens are itsdangerousURLSafeTimedSerializer payloads (containing the OSM user ID) that are then base64-encoded. The full value you put in the Authorization header looks like:
TM_SECRET environment variable. In production this must be set to a long, random string. In local testing without TM_SECRET set, the fallback entropy "un1testingmode" is used — tokens generated in this mode will not be valid against a differently configured instance.
Which Endpoints Require Authentication
Authentication required — allPOST, PUT, PATCH, and DELETE requests, plus user-specific GET endpoints such as:
GET /api/v2/users/{user_id}/(own profile)GET /api/v2/notifications/GET /api/v2/users/{user_id}/tasks/
GET /api/v2/projects/— list public projectsGET /api/v2/projects/{project_id}/— fetch a public projectGET /api/v2/system/statistics/— platform-wide statisticsGET /api/v2/system/heartbeat/— health checkGET /api/v2/countries/— country list
Invalid Token Response
When a token is missing, malformed, or expired, the API returns401 Unauthorized with the following body and a WWW-Authenticate: Bearer response header:
Human-readable error message describing why authentication failed.
Machine-readable sub-code.
InvalidToken means the token is absent, cannot be decoded, or the signature has expired.Email Verification
Users can verify their email address independently of the main OAuth flow using a time-limited token sent to their inbox:The OSM display name of the user verifying their email.
The verification token included in the email sent by the Tasking Manager. Valid for 24 hours (86 400 seconds).
200 OK response with { "Status": "OK" } confirms the email address has been verified. A 403 Forbidden is returned if the token is invalid, expired, or does not match the user’s stored email address.