OAuth Integration
ShellApps ID acts as an OAuth 2.0 provider, allowing third-party applications to authenticate users via ShellApps ID.
OAuth 2.0 Authorization Code Flow
┌──────────┐ 1. Redirect ┌─────────────────┐
│ Your App │ ──────────────────── │ auth.shellapps.com │
│ │ │ /oauth/authorize │
│ │ 2. User logs in │ │
│ │ │ │
│ │ 3. Redirect back │ │
│ │ ◄─────────────────── │ ?code=abc123 │
│ │ └─────────────────────┘
│ │ 4. Exchange code
│ │ ──────────────────── POST /oauth/token
│ │
│ │ 5. Access token
│ │ ◄─────────────────── { access_token, ... }
└──────────┘Step 1: Redirect to Authorize
https://auth.shellapps.com/oauth/authorize?
client_id=your_client_id&
redirect_uri=https://your-app.com/callback&
response_type=code&
scope=profile+groups&
state=random_csrf_tokenStep 2: Exchange Code for Token
const response = await fetch('https://auth.shellapps.com/api/v1/oauth/token', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
grant_type: 'authorization_code',
code: 'abc123',
client_id: 'your_client_id',
client_secret: 'your_client_secret',
redirect_uri: 'https://your-app.com/callback',
}),
});
const { access_token, refresh_token, expires_in, scope } = await response.json();Step 3: Use the Token
const user = await fetch('https://auth.shellapps.com/api/v1/auth/session', {
headers: { Authorization: `Bearer ${access_token}` },
}).then(r => r.json());Scopes
| Scope | Access |
|---|---|
profile | Read user's active profile (name, avatar) |
profile.write | Update profile information |
groups | Read group memberships |
groups.write | Manage group memberships |
email | Read user's email address |
Registering Your App
Register your OAuth application at auth.shellapps.com/developer:
- Provide your app name and redirect URIs
- Receive a
client_idandclient_secret - Configure allowed scopes
Token Refresh
OAuth tokens follow the same refresh flow as regular sessions:
const response = await fetch('https://auth.shellapps.com/api/v1/oauth/token', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
grant_type: 'refresh_token',
refresh_token: 'rt_...',
client_id: 'your_client_id',
client_secret: 'your_client_secret',
}),
});Related
- Auth Overview — How ShellApps ID works
- API Reference — Full endpoint documentation
- Profiles — Profile data available via OAuth