Overview
The Authentication Service manages user authentication, authorization, and session management for Macro. It provides multiple authentication methods including password-based login, passwordless email links, OAuth (Google, Apple, GitHub), and SSO. Base URL:/
Authentication: Most endpoints are public (login, signup). Protected endpoints require JWT authentication.
Core Concepts
Authentication Methods
The service supports multiple authentication flows:- Password login - Traditional email/password
- Passwordless - Magic link sent via email
- OAuth - Google, Apple, GitHub
- SSO - SAML-based enterprise SSO
JWT Tokens
Authentication results in two tokens:- Access Token - Short-lived (1 hour), used for API requests
- Refresh Token - Long-lived (30 days), used to obtain new access tokens
User Linking
Users can link multiple authentication methods (e.g., password + Google) to the same account.Login
Password Login
User email address
User password
JWT access token (1 hour expiry)
JWT refresh token (30 day expiry)
Emails are automatically converted to lowercase. If the user exists but isn’t registered in the tenant, they are automatically registered.
Passwordless Login
User email address
URL to redirect to after successful authentication
Status:
email_sentApple Login
Apple ID token from Sign in with Apple
Apple authorization code
SSO Login
Organization ID for SSO
Post-login redirect URL
OAuth
Google OAuth
URL to return to after OAuth completes
Google OAuth Callback
Authorization code from Google
State parameter for CSRF protection
User Management
Create User
User email address
User password (minimum 8 characters)
User’s full name
Created user ID
Whether verification email was sent
Get User Info
User ID (format:
macro|[email protected])User email
User’s full name
Whether email is verified
Organization ID (if user is in an org)
Account creation timestamp
Update User Name
New display name
Get User Name
Delete User
Get User Quota
Document quota (current count and limit)
Storage quota (current usage and limit)
API call quota for current period
Update User Tutorial Status
Tutorial step identifier
Whether the step is completed
Update AI Consent
Whether user consents to AI features
JWT & Session Management
Refresh Access Token
Current refresh token
New access token
The refresh token is also renewed and returned. Old tokens are invalidated.
Generate Macro API Token
API token (valid for 1 year)
Token expiration time
Logout
Account Linking
Create GitHub Link
URL to redirect after linking completes
Remove Account Link
Provider to unlink:
google, apple, githubCheck Link Exists
Provider to check:
google, apple, github, gmailWhether the link exists
Permissions
Get User Permissions
Array of permission strings
Feature flags and their enabled status
Get Legacy User Permissions
Teams & Organizations
Get User Organization
Organization ID
Organization name
User’s role in the organization
Update User Group
New group ID
Error Codes
Common Errors
200- Success201- Created400- Bad Request (invalid email, weak password)401- Unauthorized (invalid credentials)403- Forbidden (email not verified, account locked)404- User not found429- Too Many Requests (rate limited)500- Internal Server Error
Service-Specific Error Codes
Human-readable error description
INVALID_CREDENTIALS- Email/password combination is incorrectEMAIL_NOT_VERIFIED- User hasn’t verified their email addressACCOUNT_LOCKED- Account has been locked due to security concernsTOKEN_EXPIRED- JWT token has expiredTOKEN_INVALID- JWT token is malformed or invalidRATE_LIMIT_EXCEEDED- Too many login attempts
EMAIL_IN_USE- Email already registeredWEAK_PASSWORD- Password doesn’t meet complexity requirementsINVALID_EMAIL- Email format is invalid