Authentication Methods Overview
API Key Authentication
For server-to-server communication and administrative operations:JWT Bearer Authentication
For wallet-based operations and user sessions:API Key Authentication
API Key authentication is used for administrative operations like creating wallets, minting tokens, and managing objects.How It Works
- Obtain API Key: Get your API key from G2C Platform support
- Include in Headers: Add the key to the
X-API-Keyheader in every request - Access Resources: Use the key for all authenticated API calls
Getting Your API Key
To obtain your API key:- Log In: Access the Dashboard
- Navigate to Administration: Go to Administration > API Keys
- Create a New Key: Click on “Create API Key” and configure the desired permissions
- Test Access: Verify your credentials with a health check
Example API Key Requests
JWT Bearer Authentication
JWT Bearer authentication is used for wallet-based operations after a wallet has been authenticated.How It Works
- Wallet Login: Authenticate a wallet with username and password
- Receive JWT Token: Get a JWT token with expiration time
- Use Bearer Token: Include the token in Authorization headers
- Refresh When Needed: Refresh tokens before they expire
Wallet Authentication Flow
Step 1: Login to Get JWT Token
Step 2: Use JWT Token for Wallet Operations
Which Authentication Method to Use?
| Operation | Authentication Method | Use Case |
|---|---|---|
| Create Wallets | API Key | Administrative operations |
| Mint Tokens | API Key | Server-to-server token creation |
| Manage Categories/Objects | API Key | Content management |
| Wallet Login/Logout | None / JWT | User authentication |
| Token Transfers | API Key | Administrative transfers |
| File Uploads | API Key | Content management |
Security Best Practices
API Key Security
- Store Securely: Keep API keys in environment variables
- Never Expose: Don’t include keys in client-side code or public repositories
- Rotate Regularly: Update keys periodically for security
- Use HTTPS: Always use secure connections
JWT Token Security
- Short Lifespan: Tokens expire to limit exposure
- Secure Storage: Store tokens securely on the client side
- Refresh Proactively: Refresh tokens before they expire
- Logout Properly: Always invalidate tokens when logging out