Overview
RaidHub uses JWT (JSON Web Token) authentication for protected endpoints. There are two authorization endpoints:- User Authorization: For regular users accessing their own protected resources
- Admin Authorization: For administrators accessing admin-only endpoints
User Authorization
Authenticate a user and receive a JWT token for accessing user-specific protected resources.Endpoint
Request Body
The user’s Bungie.net membership ID (as a digit string)
Array of Destiny membership IDs associated with this user (int64 as strings)
Client secret for user authentication. This should be obtained through your OAuth flow with Bungie.net.
Response
JWT token to use for authenticated requests
ISO 8601 timestamp when the token expires (30 days from issue)
Example Request
Example Response
Token Expiry
User tokens expire after 30 days (2,592,000 seconds).Admin Authorization
Authorize an admin user and receive a JWT token for accessing admin-only endpoints.Endpoint
Request Body
The admin user’s Bungie.net membership ID (as a digit string)
Admin client secret. This is a different secret from the user client secret and should be kept highly confidential.
Response
JWT token to use for admin-authenticated requests
ISO 8601 timestamp when the token expires (1 hour from issue)
Example Request
Example Response
Token Expiry
Admin tokens expire after 1 hour (3,600 seconds) for security purposes.Using JWT Tokens
Include the JWT token in theAuthorization header of subsequent requests:
Error Responses
Both endpoints return the same error for invalid credentials:Invalid Client Secret Error - The provided client secret is incorrect
Example Error
Security Considerations
- User secrets should be obtained through a secure OAuth flow with Bungie.net
- Admin secrets should only be used in secure backend services
- Tokens should be stored securely and transmitted only over HTTPS
- Implement token refresh logic before expiry to maintain authenticated sessions
Token Claims
The JWT token contains the following claims:bungieMembershipId: The Bungie.net membership IDisAdmin: Boolean indicating admin statusdestinyMembershipIds: Array of Destiny membership IDs (user tokens only)iat: Issued at timestampexp: Expiration timestamp
Integration Flow
User Flow
- User authenticates with Bungie.net via OAuth
- Your backend exchanges OAuth token for RaidHub client secret
- Call
/authorize/userwith client secret to obtain JWT - Use JWT for subsequent API requests
- Refresh token before 30-day expiry
Admin Flow
- Securely store admin client secret in environment variables
- Call
/authorize/adminto obtain short-lived JWT - Use JWT for admin operations
- Obtain new token every hour