Service Definition
The Authentication service is defined inkyber_api.proto:
Authentication Methods
Login
Authenticates a user using their EA token and returns Kyber credentials. Endpoint:Authentication.Login
Request:
EA authentication token (JWT)
User ID (equals EA persona ID)
Kyber authentication token for subsequent requests
User’s display name
Whether the user is a Patreon supporter
List of user entitlements and permissions
Linked Discord account information, if available
API/internal/rpc/authentication.go:386
Validation:
- Validates EA token using JWKS
- Checks if EA account is active (not banned/suspended)
- Verifies user has persona information
- Enforces whitelist if enabled
- Checks for global bans
- Detects and blocks VPN connections (for new users)
Verify
Verifies the current user’s authentication token and returns user information. Endpoint:Authentication.Verify
Request: Empty
Response:
User ID
User’s display name
Linked Discord account information
API/internal/rpc/authentication.go:352
Reset Token
Generates a new authentication token for the current user, invalidating the previous token. Endpoint:Authentication.ResetToken
Request: Empty
Response: Empty (success)
Authentication: Required (Kyber token)
Implementation: API/internal/rpc/authentication.go:372
Patreon Integration
Patreon Login
Authenticates using a Patreon OAuth authorization code. Endpoint:Authentication.PatreonLogin
Request:
OAuth authorization code from Patreon
Patreon user ID
Patreon membership ID
OAuth token information for future requests
API/internal/rpc/authentication.go:286
Validation:
- Verifies active Patreon membership
- Checks for valid tier subscription
- Requires Discord account linked to Patreon
Link Patreon Account
Links a Patreon account to the current Kyber user. Endpoint:Authentication.LinkPatreonAccount
Request:
EA authentication token
Patreon user ID
Patreon membership ID
API/internal/rpc/authentication.go:160
Validation:
- EA account must be active
- Patreon membership must be active
- Valid tier subscription required
- Discord must be linked to Patreon
- Prevents duplicate Discord account linking
Unlink Patreon Account
Removes the Patreon account link from the current user. Endpoint:Authentication.UnlinkPatreonAccount
Request: Empty
Response: Empty (success)
Authentication: Required (Kyber token)
Implementation: API/internal/rpc/authentication.go:133
Note: This also regenerates the user’s Kyber token.
Discord Integration
Unlink Discord Account
Removes the Discord account link from the current user. Endpoint:Authentication.UnlinkDiscordAccount
Request: Empty
Response: Empty (success)
Authentication: Required (Kyber token)
Implementation: API/internal/rpc/authentication.go:264
Data Models
DiscordUserData
TokenInfo
Error Codes
The Authentication API uses standard gRPC status codes:UNAUTHENTICATED(16) - Invalid or missing authentication tokenPERMISSION_DENIED(7) - User is banned, account is inactive, or not whitelistedINTERNAL(13) - Server-side errorUNIMPLEMENTED(12) - Patreon features are disabledNOT_FOUND(5) - User or resource not foundALREADY_EXISTS(6) - Account already linked
Authentication Flow
- Initial Login: Client calls
Loginwith EA token - Receive Kyber Token: Server validates EA token and returns Kyber token
- Subsequent Requests: Client includes Kyber token in metadata header
- Token Verification: Server uses interceptor to validate token on each request
- Optional: Link Patreon/Discord accounts for additional features
Configuration
The Authentication service requires the following environment variables:PATREON_ACCESS_TOKEN- Patreon API access tokenPATREON_CLIENT_SECRET- Patreon OAuth client secretPATREON_CLIENT_ID- Patreon OAuth client IDWHITELIST_ENABLED- Enable/disable whitelist enforcement (default: true)KYBER_EA_BRIDGE- EA Bridge gRPC service address
Rate Limiting
- EA username refresh: Every 7 days
- Discord data refresh: Every 24 hours
- EA entitlement check: Every 48 hours
- Patreon membership check: Every 24 hours