본문 바로가기
WIKI 기술 지식 베이스

현재 사용자 조회

원문 보기 위키 갱신

현재 사용자 조회 (Get Current User)

현재 인증된 사용자의 정보를 확인하는 엔드포인트예요. 사용자 이름, 이메일, 플랜, MFA 설정 여부까지 한 번에 살펴볼 수 있어요.

출처: 문서

본문

Returns information about the currently authenticated user.

GET /v1/user를 호출하면 현재 인증된 사용자 정보를 받아요.

```bash cURL theme={null} curl -L https://api.turso.tech/v1/user \ -H 'Authorization: Bearer ***' ```
import { createClient } from "@tursodatabase/api";

const turso = createClient({
  org: "...",
  token: "",
});

const user = await turso.users.getCurrent();

OpenAPI

openapi: 3.0.1
info:
  title: Turso Platform API
  description: API description here
  license:
    name: MIT
  version: 0.1.0
servers:
  - url: https://api.turso.tech
    description: Turso's Platform API
security: []
paths:
  /v1/user:
    get:
      summary: Get Current User
      description: Returns information about the currently authenticated user.
      operationId: getCurrentUser
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  user:
                    type: object
                    properties:
                      username:
                        type: string
                        description: The username of the user.
                        example: iku
                      name:
                        type: string
                        description: The display name of the user.
                        example: Iku Turso
                      email:
                        type: string
                        description: The primary email address of the user.
                        example: [email protected]
                      avatarUrl:
                        type: string
                        description: URL to the user's avatar image.
                        example: https://avatars.githubusercontent.com/u/12345
                      plan:
                        type: string
                        description: The user's current plan.
                        example: scaler
                      mfa:
                        type: boolean
                        description: >-
                          Whether the user has multi-factor authentication
                          enabled.
                        example: false
                      has_pending_invites:
                        type: boolean
                        description: >-
                          Whether the user has pending organization invites
                          waiting to be accepted or declined.
                        example: false

더 알아보기 (Learn more)