Authentication
Current User Identity
Get the current authenticated user's identity (id, email, username, displayName, avatar, status, emailVerified).
GET /api/v1/auth/me — 🔑 User-auth (Bearer JWT) · Rate limit: 60 req / hour
Returns the current authenticated user's identity. Lightweight — only canonical user fields, no role or permission data (use /users/profile for richer profile).
This is the canonical "who am I" endpoint — frontends typically call it on app boot to hydrate the auth state and decide rendering (creator vs fan, verified vs unverified, status).
Request
Headers
| Header | Value | Notes |
|---|---|---|
Authorization | Bearer <accessToken> | Required |
No body, no query params.
Response
200 OK — ApiResponseOf<UserIdentityResponseDto>
{
"success": true,
"data": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"email": "[email protected]",
"username": "creator",
"displayName": "Awesome Creator",
"avatarUrl": "https://cdn.bio.re/avatars/abc.jpg",
"status": "ACTIVE",
"emailVerified": true
}
}UserIdentityResponseDto fields
| Field | Type | Notes |
|---|---|---|
id | string (UUID) | User.id |
email | string | User.email (lowercase) |
username | string | null | User.username (nullable — fan accounts may not have one) |
displayName | string | null | User.displayName |
avatarUrl | string | null | User.avatarUrl |
status | enum | One of: ACTIVE, SUSPENDED, BANNED, DELETED, DEACTIVATED |
emailVerified | boolean | User.emailVerified |
Errors
| HTTP | code / i18nKey | Reason |
|---|---|---|
401 | (no JWT or invalid) | Not authenticated or token expired |
429 | (throttle) | Rate limit exceeded (60 req/hour) |
Side effects
- Lookup
Userbyid(decoded from JWT). - Project to
UserIdentityResponseDto(no relations loaded). - No mutations.
Code samples
curl -X GET https://api.bio.re/api/v1/auth/me \
-H 'Authorization: Bearer <accessToken>'type Identity = {
id: string;
email: string;
username: string | null;
displayName: string | null;
avatarUrl: string | null;
status: 'ACTIVE' | 'SUSPENDED' | 'BANNED' | 'DELETED' | 'DEACTIVATED';
emailVerified: boolean;
};
async function getMe(accessToken: string): Promise<Identity> {
const res = await fetch('https://api.bio.re/api/v1/auth/me', {
headers: { 'Authorization': `Bearer ${accessToken}` },
});
const json = await res.json();
if (!res.ok || !json.success) {
throw Object.assign(new Error(json?.error?.message ?? 'Failed'), {
code: json?.error?.code,
});
}
return json.data;
}import { useQuery } from '@tanstack/react-query';
export const meKeys = {
identity: ['auth', 'me'] as const,
};
export function useMe() {
return useQuery({
queryKey: meKeys.identity,
queryFn: async () => {
const res = await fetch('/api/v1/auth/me', {
headers: { 'Authorization': `Bearer ${getAccessToken()}` },
});
const json = await res.json();
if (!res.ok || !json.success) {
if (res.status === 401) {
// Trigger refresh flow or redirect to login
throw Object.assign(new Error('Unauthenticated'), { code: 'auth.unauthenticated' });
}
throw Object.assign(new Error(json?.error?.message ?? 'Failed'), {
code: json?.error?.code,
});
}
return json.data as Identity;
},
staleTime: 5 * 60 * 1000, // 5 min — identity rarely changes
});
}Try it
Authorization
bearer AuthorizationBearer <token>
In: header
Response Body
application/json
application/json
curl -X GET "https://loading/api/v1/auth/me"{
"success": true,
"data": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"email": "[email protected]",
"username": "johndoe",
"displayName": "John Doe",
"avatarUrl": "https://cdn.bio.re/avatars/abc.jpg",
"status": "ACTIVE",
"emailVerified": true,
"locale": "en",
"intent": "creator",
"twoFactorEnabled": false,
"isCreator": true
}
}{
"success": false,
"error": {
"code": "AUTH_UNAUTHORIZED",
"message": "Invalid credentials",
"i18nKey": "auth.login.invalid_credentials",
"i18nVars": {
"field": "email"
},
"details": [
{
"message": "email must be an email"
}
],
"correlationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
}Source
| Source | Path | Lines |
|---|---|---|
| Controller | apps/api-core/src/modules/auth/auth.controller.ts | 299–313 |
| DTO (response) | apps/api-core/src/modules/auth/dto/response.dto.ts | 49–82 (UserIdentityResponseDto) |
| Service | apps/api-core/src/modules/auth/auth.service.ts | getIdentity(userId) |
| Prisma model | packages/prisma/prisma/schema.prisma | User (status, emailVerified, username) |