Authentication
All endpoints in the Gameye Session API require authentication. This guide explains how to properly authenticate your requests.
Bearer Token Authentication
Section titled “Bearer Token Authentication”The Gameye Session API uses Bearer Token Authentication, which means you need to include an API token in the header of every request.
How to Use Your Token
Section titled “How to Use Your Token”Add your token to the Authorization header in this format:
Authorization: Bearer YOUR_TOKEN_HEREExample
Section titled “Example”GET /session HTTP/1.1Host: api.gameye.ioAuthorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...Obtaining a Token
Section titled “Obtaining a Token”To get an API token:
- Contact Gameye to set up an account
- Request an API token for your account
- Store your token securely - treat it like a password!
Token Security
Section titled “Token Security”Here are some best practices for keeping your token secure:
- Never share your token in public repositories or client-side code
- Use environment variables to store your token in your applications
- Consider rotating your token periodically
- Use the sandbox environment for testing
Authentication Errors
Section titled “Authentication Errors”If authentication fails, you’ll receive a 401 Unauthorized response with details about the error. Common reasons for authentication failure include:
- Missing token
- Invalid token format
- Expired token
- Token doesn’t have permission for the requested resource
Example Error Response
Section titled “Example Error Response”{ "statusCode": 401, "code": "UNAUTHORIZED", "message": "Authentication failed", "details": "Invalid bearer token", "path": "/session", "identifier": "abc123", "timestamp": "2023-04-01T12:00:00Z"}Next Steps
Section titled “Next Steps”Once you’ve set up authentication, you can:
- Create your first game session
- Check available locations for hosting your game