1 /**
2 * @oas [post] /auth/token/refresh
3 * operationId: PostAdminAuthTokenRefresh
4 * summary: Refresh Authentication Token
5 * description: Refresh the authentication token of a user. This is useful after authenticating a user with a third-party service to ensure the token holds the new user's details, or when you don't want users to re-login every day.
6 * externalDocs:
7 * url: https://docs.medusajs.com/resources/commerce-modules/auth/authentication-route#2-third-party-service-authenticate-flow
8 * description: Learn about third-party authentication flow.
9 * x-authenticated: true
10 * x-codeSamples:
11 * - lang: JavaScript
12 * label: JS SDK
13 * source: |-
14 * import Medusa from "@medusajs/js-sdk"
15 *
16 * export const sdk = new Medusa({
17 * baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
18 * debug: import.meta.env.DEV,
19 * auth: {
20 * type: "session",
21 * },
22 * })
23 *
24 * const token = await sdk.auth.refresh()
25 *
26 * // all subsequent requests will use the token in the header
27 * const { user } = await sdk.admin.user.me()
28 * - lang: Shell
29 * label: cURL
30 * source: |-
31 * curl -X POST '{backend_url}/auth/token/refresh' \
32 * -H 'Authorization: Bearer {token}'
33 * tags:
34 * - Auth
35 * responses:
36 * "200":
37 * description: OK
38 * content:
39 * application/json:
40 * schema:
41 * $ref: "#/components/schemas/AuthResponse"
42 * "400":
43 * $ref: "#/components/responses/400_error"
44 * "401":
45 * $ref: "#/components/responses/unauthorized"
46 * "404":
47 * $ref: "#/components/responses/not_found_error"
48 * "409":
49 * $ref: "#/components/responses/invalid_state_error"
50 * "422":
51 * $ref: "#/components/responses/invalid_request_error"
52 * "500":
53 * $ref: "#/components/responses/500_error"
54 *
55 */
56