OAuth2 Resource
OAuth2 allows third-party applications to access Fluxer user data and perform actions on their behalf.Application Object
Structure
Unique application identifier
Application name (1-100 characters)
Hash of the application’s icon
Application description (max 400 characters)
User who owns the application
ID of the owner user
User ID of the application’s bot (if it has one)
Whether the bot can be added by anyone
Whether the bot requires OAuth2 code grant
URL to terms of service
URL to privacy policy
OAuth2 redirect URIs
OAuth2 client secret (only shown to owner)
Verification key for interactions
Version for optimistic concurrency control
Example Application
OAuth2 Scopes
Scopes define what permissions an application requests from users.Authorization Flow
1. Authorization Request
Direct users to the authorization URL:Your application’s client ID
One of your registered redirect URIs
Must be
code for authorization code grantSpace-separated list of scopes
CSRF protection token (highly recommended)
none or consent - controls consent screen display2. User Authorization
User sees a consent screen and approves or denies the request.3. Callback
Fluxer redirects back to your redirect URI:4. Token Exchange
Exchange the authorization code for an access token:5. Using Access Tokens
Include the access token in API requests:Token Types
Access Token
Bearer token for API requests
Always “Bearer”
Seconds until token expires (typically 7 days)
Space-separated granted scopes
Refresh Token
Token for refreshing the access token
- Do not expire (until revoked)
- Can only be used once
- Return a new access token and refresh token
Refreshing Tokens
When an access token expires, use the refresh token:Revoking Tokens
Revoke an access token or refresh token:Client Credentials
For bot-only applications, use client credentials grant:Endpoints
Create Application
Application name (1-100 characters)
Get Application
Get Current Application
Modify Application
New name
New description
Base64 encoded icon
OAuth2 redirect URIs
Terms of service URL
Privacy policy URL
Delete Application
Reset Client Secret
Get Authorized Applications
Revoke Authorization
Best Practices
- Never expose client secrets - Keep them server-side only
- Use state parameter - Prevent CSRF attacks
- Request minimum scopes - Only ask for what you need
- Handle token expiration - Implement refresh token flow
- Secure redirect URIs - Use HTTPS and validate URIs
- Store tokens securely - Encrypt tokens in your database
- Implement token revocation - Allow users to disconnect