Skip to content

Commit 46ba9c6

Browse files
authored
Merge pull request laravel#40 from eurides-eu/feature/add-authentication-docs
Feature/add authentication docs
2 parents 3b09eba + 542a8e2 commit 46ba9c6

File tree

4 files changed

+137
-4
lines changed

4 files changed

+137
-4
lines changed

.env.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ REDIS_PORT=6379
2626
MAIL_DRIVER=smtp
2727
MAIL_HOST=smtp.mailtrap.io
2828
MAIL_PORT=2525
29-
MAIL_USERNAME=null
30-
MAIL_PASSWORD=null
29+
MAIL_USERNAME=d88d6fc004652c
30+
MAIL_PASSWORD=aa997006998217
3131
MAIL_ENCRYPTION=null
3232

3333
PUSHER_APP_ID=

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
* `./dev artisan key:generate`
88
* `./dev artisan migrate`
99

10+
## API documentation
11+
12+
We are using [Swagger 2](https://swagger.io/) for documenting all the endpoints. The swagger file is served to the consumers
13+
via [readme.io](https://dash.readme.io/go/eurides-mobility-shop-api). At the moment the file needs to be manually updated
14+
on Readme after it changes, there is no auto sync.
15+
16+
You can use [editor.swagger.io](https://editor.swagger.io/) for easier editing this file.
17+
1018
## Docker
1119

1220
### Installation

docs/api-endpoints.yml

Lines changed: 124 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,119 @@ info:
44
version: "1.0.0"
55
title: "Eurides API"
66
host: "develop.eurides.mwlhq.com"
7-
basePath: "/"
7+
basePath: "/api"
88
schemes:
99
- "http"
1010
paths:
11+
/signin:
12+
post:
13+
tags:
14+
- "Authentication"
15+
summary: "Request a passwordless login code via email"
16+
description: ""
17+
produces:
18+
- "application/json"
19+
parameters:
20+
- in: "body"
21+
name: "body"
22+
description: "Email of the user that needs a login code"
23+
required: true
24+
schema:
25+
type: object
26+
properties:
27+
email:
28+
type: "string"
29+
example: "john@doe.com"
30+
responses:
31+
200:
32+
description: "Email was sent"
33+
422:
34+
description: ""
35+
schema:
36+
$ref: "#/definitions/ErrorResponse"
37+
/signin/code:
38+
post:
39+
tags:
40+
- "Authentication"
41+
summary: "Get an access token in exchange for a passwordless login code"
42+
description: ""
43+
produces:
44+
- "application/json"
45+
parameters:
46+
- in: "body"
47+
name: "body"
48+
description: "Passwordless login code received via email"
49+
required: true
50+
schema:
51+
type: object
52+
properties:
53+
code:
54+
type: "string"
55+
example: "1234abcd"
56+
responses:
57+
200:
58+
description: ""
59+
schema:
60+
type: object
61+
properties:
62+
accessToken:
63+
type: "string"
64+
example: "abcdefghijklmnopqrstuvwxyz"
65+
422:
66+
description: ""
67+
schema:
68+
$ref: "#/definitions/ErrorResponse"
69+
/oauth/token:
70+
post:
71+
tags:
72+
- "Authentication"
73+
summary: "Get an access token using oAuth2 client_credentials grant"
74+
description: ""
75+
produces:
76+
- "application/json"
77+
parameters:
78+
- in: "body"
79+
name: "body"
80+
description: "Client credentials of the organisation"
81+
required: true
82+
schema:
83+
type: object
84+
properties:
85+
grant_type:
86+
type: "string"
87+
example: "client_credentials"
88+
client_id:
89+
type: "string"
90+
example: "1233"
91+
client_secret:
92+
type: "string"
93+
example: "abcd1234"
94+
responses:
95+
200:
96+
description: ""
97+
schema:
98+
type: object
99+
properties:
100+
token_type:
101+
type: "string"
102+
example: "Bearer"
103+
expires_in:
104+
type: "number"
105+
example: 604799
106+
access_token:
107+
type: "string"
108+
example: "abcdefghijklmnopqrstuvwxyz"
109+
401:
110+
description: ""
111+
schema:
112+
type: object
113+
properties:
114+
error:
115+
type: "string"
116+
example: "Invalid client"
117+
message:
118+
type: "string"
119+
example: "Client authentication failed"
11120
/users/me:
12121
get:
13122
tags:
@@ -1431,6 +1540,20 @@ definitions:
14311540
page:
14321541
type: "integer"
14331542
example: 2
1543+
ErrorResponse:
1544+
type: "object"
1545+
properties:
1546+
message:
1547+
type: "string"
1548+
example: "The given data is invalid"
1549+
errors:
1550+
type: "array"
1551+
items:
1552+
type: "object"
1553+
properties:
1554+
email:
1555+
type: "string"
1556+
example: "The selected email is invalid."
14341557
Subscription:
14351558
type: "object"
14361559
required:

routes/web.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,7 @@
1212
*/
1313

1414
Route::get('/', function () {
15-
return view('welcome');
15+
return new \Illuminate\Http\JsonResponse(
16+
['message' => "Nothing to see here, move along"]
17+
);
1618
});

0 commit comments

Comments
 (0)