Token
기술

Token

작성일: 2023년 01월 06일0

Token?

화폐나 출입증처럼 약속된 정보가 동일하면 서버와의 접속이 가능하게 하는 도구입니다.

데이터를 암호화하여 클라이언트에 쿠키 등으로 저장합니다.


어떻게 쓰는지?

{
  "object": "block",
  "id": "b85f4011-3c15-4640-a74f-09b01127a74d",
  "parent": {
    "type": "page_id",
    "page_id": "390765fe-8b67-8128-a118-c490f0d4f709"
  },
  "created_time": "2026-07-01T14:44:00.000Z",
  "last_edited_time": "2026-07-01T14:44:00.000Z",
  "created_by": {
    "object": "user",
    "id": "2ecd872b-594c-81f7-92e3-000210a8d473"
  },
  "last_edited_by": {
    "object": "user",
    "id": "2ecd872b-594c-81f7-92e3-000210a8d473"
  },
  "has_children": false,
  "in_trash": false,
  "type": "heading_4",
  "heading_4": {
    "rich_text": [
      {
        "type": "text",
        "text": {
          "content": "1. Header",
          "link": null
        },
        "annotations": {
          "bold": false,
          "italic": false,
          "strikethrough": false,
          "underline": false,
          "code": false,
          "color": "default"
        },
        "plain_text": "1. Header",
        "href": null
      }
    ],
    "is_toggleable": false,
    "color": "default"
  },
  "archived": false
}
  • 어떤 종류의 토큰인가?
  • 어떤 알고리즘으로 암호화 하는가?
  • {
      "object": "block",
      "id": "2ff31f19-1006-43de-8bb8-869cfcf12de4",
      "parent": {
        "type": "page_id",
        "page_id": "390765fe-8b67-8128-a118-c490f0d4f709"
      },
      "created_time": "2026-07-01T14:44:00.000Z",
      "last_edited_time": "2026-07-01T14:44:00.000Z",
      "created_by": {
        "object": "user",
        "id": "2ecd872b-594c-81f7-92e3-000210a8d473"
      },
      "last_edited_by": {
        "object": "user",
        "id": "2ecd872b-594c-81f7-92e3-000210a8d473"
      },
      "has_children": false,
      "in_trash": false,
      "type": "heading_4",
      "heading_4": {
        "rich_text": [
          {
            "type": "text",
            "text": {
              "content": "2. Payload",
              "link": null
            },
            "annotations": {
              "bold": false,
              "italic": false,
              "strikethrough": false,
              "underline": false,
              "code": false,
              "color": "default"
            },
            "plain_text": "2. Payload",
            "href": null
          }
        ],
        "is_toggleable": false,
        "color": "default"
      },
      "archived": false
    }
  • 유저의 정보
  • 권한을 부여받았는가?(optional)
  • 기타 필요한 정보
  • {
      "object": "block",
      "id": "b3654419-5b60-43f5-850b-ea510149c976",
      "parent": {
        "type": "page_id",
        "page_id": "390765fe-8b67-8128-a118-c490f0d4f709"
      },
      "created_time": "2026-07-01T14:44:00.000Z",
      "last_edited_time": "2026-07-01T14:44:00.000Z",
      "created_by": {
        "object": "user",
        "id": "2ecd872b-594c-81f7-92e3-000210a8d473"
      },
      "last_edited_by": {
        "object": "user",
        "id": "2ecd872b-594c-81f7-92e3-000210a8d473"
      },
      "has_children": false,
      "in_trash": false,
      "type": "heading_4",
      "heading_4": {
        "rich_text": [
          {
            "type": "text",
            "text": {
              "content": "3. Signature",
              "link": null
            },
            "annotations": {
              "bold": false,
              "italic": false,
              "strikethrough": false,
              "underline": false,
              "code": false,
              "color": "default"
            },
            "plain_text": "3. Signature",
            "href": null
          }
        ],
        "is_toggleable": false,
        "color": "default"
      },
      "archived": false
    }
  • Header, Payload를 base64인코딩한 값과 salt값의 조합으로 암호화된 값(Hashing)
  • Notion Image

    Notion Image

    토큰의 종류

    {
      "object": "block",
      "id": "43ebdef3-5e7f-4175-9375-bd7911b32e80",
      "parent": {
        "type": "page_id",
        "page_id": "390765fe-8b67-8128-a118-c490f0d4f709"
      },
      "created_time": "2026-07-01T14:44:00.000Z",
      "last_edited_time": "2026-07-01T14:44:00.000Z",
      "created_by": {
        "object": "user",
        "id": "2ecd872b-594c-81f7-92e3-000210a8d473"
      },
      "last_edited_by": {
        "object": "user",
        "id": "2ecd872b-594c-81f7-92e3-000210a8d473"
      },
      "has_children": false,
      "in_trash": false,
      "type": "heading_4",
      "heading_4": {
        "rich_text": [
          {
            "type": "text",
            "text": {
              "content": "엑세스 토큰",
              "link": null
            },
            "annotations": {
              "bold": false,
              "italic": false,
              "strikethrough": false,
              "underline": false,
              "code": false,
              "color": "default"
            },
            "plain_text": "엑세스 토큰",
            "href": null
          }
        ],
        "is_toggleable": false,
        "color": "default"
      },
      "archived": false
    }

    실제 출입용

    {
      "object": "block",
      "id": "82ebc1f6-efc4-4ffc-91f9-fd74e6aff934",
      "parent": {
        "type": "page_id",
        "page_id": "390765fe-8b67-8128-a118-c490f0d4f709"
      },
      "created_time": "2026-07-01T14:44:00.000Z",
      "last_edited_time": "2026-07-01T14:44:00.000Z",
      "created_by": {
        "object": "user",
        "id": "2ecd872b-594c-81f7-92e3-000210a8d473"
      },
      "last_edited_by": {
        "object": "user",
        "id": "2ecd872b-594c-81f7-92e3-000210a8d473"
      },
      "has_children": false,
      "in_trash": false,
      "type": "heading_4",
      "heading_4": {
        "rich_text": [
          {
            "type": "text",
            "text": {
              "content": "리프레시 토큰",
              "link": null
            },
            "annotations": {
              "bold": false,
              "italic": false,
              "strikethrough": false,
              "underline": false,
              "code": false,
              "color": "default"
            },
            "plain_text": "리프레시 토큰",
            "href": null
          }
        ],
        "is_toggleable": false,
        "color": "default"
      },
      "archived": false
    }

    엑세스 토큰 재발급용