|
1
|
post: |
|
2
|
operationId: PostActor_typeAuth_provider |
|
3
|
summary: Authenticate User |
|
4
|
description: > |
|
5
|
Authenticate a user and receive the JWT token to be used in the header of |
|
6
|
subsequent requests. |
|
7
|
|
|
8
|
|
|
9
|
When used with a third-party provider, such as Google, the request returns a |
|
10
|
`location` property. You redirect to the specified URL in your frontend to |
|
11
|
continue authentication with the third-party service. |
|
12
|
externalDocs: |
|
13
|
url: >- |
|
14
|
https://docs.medusajs.com/resources/commerce-modules/auth/authentication-route#types-of-authentication-flows |
|
15
|
description: Learn about different authentication flows. |
|
16
|
x-authenticated: false |
|
17
|
parameters: |
|
18
|
- name: auth_provider |
|
19
|
in: path |
|
20
|
description: The provider used for authentication. |
|
21
|
required: true |
|
22
|
schema: |
|
23
|
type: string |
|
24
|
example: emailpass |
|
25
|
requestBody: |
|
26
|
content: |
|
27
|
application/json: |
|
28
|
schema: |
|
29
|
type: object |
|
30
|
title: input |
|
31
|
description: > |
|
32
|
The input data necessary for authentication. |
|
33
|
|
|
34
|
For example, for email-pass authentication, pass `email` and |
|
35
|
`password` properties. |
|
36
|
|
|
37
|
For the Google and GitHub authentication providers, you can pass |
|
38
|
`callback_url` to indicate the URL in the frontend that the user |
|
39
|
should be redirected to after completing their authentication. This |
|
40
|
will override the provider's `callbackUrl` configurations in |
|
41
|
`medusa-config.ts`. |
|
42
|
x-codeSamples: |
|
43
|
- lang: JavaScript |
|
44
|
label: JS SDK |
|
45
|
source: |
|
46
|
$ref: ../code_samples/JavaScript/auth_user_{auth_provider}/post.js |
|
47
|
- lang: Bash |
|
48
|
label: Google Provider |
|
49
|
source: |
|
50
|
$ref: ../code_samples/Bash/auth_user_{auth_provider}/post.sh |
|
51
|
tags: |
|
52
|
- Auth |
|
53
|
responses: |
|
54
|
'200': |
|
55
|
description: OK |
|
56
|
content: |
|
57
|
application/json: |
|
58
|
schema: |
|
59
|
oneOf: |
|
60
|
- $ref: ../components/schemas/AuthResponse.yaml |
|
61
|
- $ref: ../components/schemas/AuthCallbackResponse.yaml |
|
62
|
'400': |
|
63
|
$ref: ../components/responses/400_error.yaml |
|
64
|
'401': |
|
65
|
$ref: ../components/responses/unauthorized.yaml |
|
66
|
'404': |
|
67
|
$ref: ../components/responses/not_found_error.yaml |
|
68
|
'409': |
|
69
|
$ref: ../components/responses/invalid_state_error.yaml |
|
70
|
'422': |
|
71
|
$ref: ../components/responses/invalid_request_error.yaml |
|
72
|
'500': |
|
73
|
$ref: ../components/responses/500_error.yaml |