Authentication
OAuth 2.0 flows, scopes, and token management.
Authentication
TaskNation uses OAuth 2.0 for all API authentication. We support two grant types depending on your integration pattern.
Authorization Code Flow (User Context)
Use this when acting on behalf of a specific TaskNation user (pro or homeowner). This is the most common flow for CRM and business management integrations.
# Step 1: Redirect user to authorize
GET https://auth.tasknation.com/oauth2/auth
?client_id=YOUR_CLIENT_ID
&response_type=code
&redirect_uri=YOUR_REDIRECT_URI
&scope=supply::businesses supply::leads offline_access
&state=RANDOM_STRING_MIN_8_CHARS
# Step 2: Exchange code for tokens
POST https://auth.tasknation.com/oauth2/token
Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code
&code=AUTH_CODE_FROM_CALLBACK
&client_id=YOUR_CLIENT_ID
&client_secret=YOUR_CLIENT_SECRET
&redirect_uri=YOUR_REDIRECT_URI
Client Credentials Flow (Application Context)
Use this for server-to-server calls that don't act on behalf of a specific user (e.g., category lookups, keyword search).
POST https://auth.tasknation.com/oauth2/token
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials
&client_id=YOUR_CLIENT_ID
&client_secret=YOUR_CLIENT_SECRET
&scope=demand::categories demand::search
Token Response
{
"access_token": "eyJhbGciOiJSUzI1NiIs...",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "xRklFvy60UpMa1...",
"scope": "supply::businesses supply::leads offline_access"
}
Scopes
| Scope | Description | Partner Type |
|---|---|---|
supply::businesses | Read/write business profiles | Supply |
supply::leads | Access and manage leads/negotiations | Supply |
supply::messages | Send and receive messages | Supply |
supply::reviews | Read business reviews | Supply |
demand::requests | Create and manage service requests | Demand |
demand::categories | Browse service categories | Demand |
demand::search | Search for businesses | Demand |
offline_access | Receive refresh tokens (180-day validity) | Both |
Refresh Token Grace Period
TaskNation implements a 60-second grace period for refresh tokens. If a network error occurs during exchange, you can retry with the same refresh token within 60 seconds.