Prerequisites
Before you begin, ensure you have:- Access to the Lens Music API
- A valid email address
- A tool for making HTTP requests (curl, Postman, or similar)
User registration
Create a new user account by signing up with your email and password.Prepare signup data
Gather the required information:
- email: A valid email address
- name: Your full name
- password: A secure password
- phone (optional): Your phone number
- role (optional): User role (defaults to standard user)
User login
Authenticate existing users to obtain a JWT token.Prepare login credentials
You only need two fields:
- email: Your registered email address
- password: Your account password
Using authentication tokens
Once you have a JWT token, include it in theAuthorization header for all protected endpoints.
Making authenticated requests
Error handling
Handle common authentication errors gracefully:User already exists (409 Conflict)
User already exists (409 Conflict)
Invalid email format (400 Bad Request)
Invalid email format (400 Bad Request)
[email protected]Invalid credentials (401 Unauthorized)
Invalid credentials (401 Unauthorized)
Token expired (401 Unauthorized)
Token expired (401 Unauthorized)
Best practices
Secure token storage
Store tokens in secure storage (e.g., httpOnly cookies, secure localStorage) and never expose them in URLs or logs.
Token refresh
Implement token refresh logic to maintain user sessions without requiring frequent re-authentication.
Password strength
Enforce strong password requirements: minimum 8 characters with uppercase, lowercase, numbers, and symbols.
Error handling
Provide clear error messages to users while avoiding security information disclosure.
Next steps
Managing artists
Create and manage artist profiles
Creating labels
Set up record labels for your releases