Skip to content

Commit 7934b07

Browse files
committed
Add auth
1 parent 65b3cfb commit 7934b07

File tree

11 files changed

+68
-32
lines changed

11 files changed

+68
-32
lines changed

.scribe/.filehashes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# GENERATED. YOU SHOULDN'T MODIFY OR DELETE THIS FILE.
22
# Scribe uses this file to know when you change something manually in your docs.
33
.scribe/index.md=c8cb5fa262a4e2884e5c37d0ebead040
4-
.scribe/authentication.md=325963d01b9a982f33c1f72830d5786d
4+
.scribe/authentication.md=aba097a14dadf1ec2bf55a1b7f74376a

.scribe/append.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Some extra info
2+
3+
Just some extra info added via an `append.md` file.
4+
5+
Go on, [go check Scribe out](https://github.com/knuckleswtf/scribe) 😄.

.scribe/authentication.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
# Authenticating requests
22

3-
This API is not authenticated.
3+
To authenticate requests, include an **`Authorization`** header with the value **`"Bearer {YOUR_AUTH_KEY}"`**.
4+
5+
All authenticated endpoints are marked with a `requires authentication` badge in the documentation below.
6+
7+
You can retrieve your token by using the `users/auth` endpoint.

.scribe/endpoints.cache/1.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ endpoints:
4949
from the controller's code. Check out the source! </aside>
5050
authenticated: true
5151
headers:
52+
Authorization: 'Bearer {YOUR_AUTH_KEY}'
5253
Content-Type: application/json
5354
Accept: application/json
5455
urlParameters: []
@@ -76,7 +77,7 @@ endpoints:
7677
name: due_at
7778
description: 'Due date for the side project. Must be a valid date. Must be a valid date in the format <code>Ymd</code>. Must be a date after <code>today</code>.'
7879
required: false
79-
example: '2077-09-25'
80+
example: '2077-09-26'
8081
type: string
8182
responses: []
8283
responseFields: []
@@ -107,7 +108,7 @@ endpoints:
107108
responses:
108109
-
109110
status: 200
110-
content: '{"data":{"name":"quo quo molestias","description":"Tempora aspernatur officiis omnis sed similique et et.","due_date":"20241229","owner":{"id":1,"name":"Pete","email":"[email protected]","email_verified_at":null,"created_at":"2021-05-29T22:53:05.000000Z","updated_at":"2021-05-29T22:53:05.000000Z"}}}'
111+
content: '{"data":{"name":"quo quo molestias","description":"Tempora aspernatur officiis omnis sed similique et et.","due_date":"20241230","owner":{"id":1,"name":"Pete","email":"[email protected]","email_verified_at":null,"created_at":"2021-05-29T22:53:05.000000Z","updated_at":"2021-05-29T22:53:05.000000Z"}}}'
111112
headers: []
112113
description: null
113114
responseFields: []

.scribe/endpoints.cache/2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ endpoints:
6262
responses:
6363
-
6464
status: 200
65-
content: '{"data":{"id":6,"name":"Dr. Kallie Schroeder","email":"[email protected]","side_projects":[{"id":10,"name":"similique et et","description":"Odit molestiae non est nostrum sunt.","url":null,"due_at":"20221027","created_at":"2021-06-01T16:38:10.000000Z","updated_at":"2021-06-01T16:38:10.000000Z","user_id":"6"}]}}'
65+
content: '{"data":{"id":6,"name":"Dr. Kallie Schroeder","email":"[email protected]","side_projects":[{"id":10,"name":"similique et et","description":"Odit molestiae non est nostrum sunt.","url":null,"due_at":"20221027","created_at":"2021-06-02T12:17:43.000000Z","updated_at":"2021-06-02T12:17:43.000000Z","user_id":"6"}]}}'
6666
headers: []
6767
description: null
6868
-

.scribe/endpoints/1.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ endpoints:
4747
from the controller's code. Check out the source! </aside>
4848
authenticated: true
4949
headers:
50+
Authorization: 'Bearer {YOUR_AUTH_KEY}'
5051
Content-Type: application/json
5152
Accept: application/json
5253
urlParameters: []
@@ -74,7 +75,7 @@ endpoints:
7475
name: due_at
7576
description: 'Due date for the side project. Must be a valid date. Must be a valid date in the format <code>Ymd</code>. Must be a date after <code>today</code>.'
7677
required: false
77-
example: '2077-09-25'
78+
example: '2077-09-26'
7879
type: string
7980
responses: []
8081
responseFields: []
@@ -105,7 +106,7 @@ endpoints:
105106
responses:
106107
-
107108
status: 200
108-
content: '{"data":{"name":"quo quo molestias","description":"Tempora aspernatur officiis omnis sed similique et et.","due_date":"20241229","owner":{"id":1,"name":"Pete","email":"[email protected]","email_verified_at":null,"created_at":"2021-05-29T22:53:05.000000Z","updated_at":"2021-05-29T22:53:05.000000Z"}}}'
109+
content: '{"data":{"name":"quo quo molestias","description":"Tempora aspernatur officiis omnis sed similique et et.","due_date":"20241230","owner":{"id":1,"name":"Pete","email":"[email protected]","email_verified_at":null,"created_at":"2021-05-29T22:53:05.000000Z","updated_at":"2021-05-29T22:53:05.000000Z"}}}'
109110
headers: []
110111
description: null
111112
responseFields: []

.scribe/endpoints/2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ endpoints:
6060
responses:
6161
-
6262
status: 200
63-
content: '{"data":{"id":6,"name":"Dr. Kallie Schroeder","email":"[email protected]","side_projects":[{"id":10,"name":"similique et et","description":"Odit molestiae non est nostrum sunt.","url":null,"due_at":"20221027","created_at":"2021-06-01T16:38:10.000000Z","updated_at":"2021-06-01T16:38:10.000000Z","user_id":"6"}]}}'
63+
content: '{"data":{"id":6,"name":"Dr. Kallie Schroeder","email":"[email protected]","side_projects":[{"id":10,"name":"similique et et","description":"Odit molestiae non est nostrum sunt.","url":null,"due_at":"20221027","created_at":"2021-06-02T12:17:43.000000Z","updated_at":"2021-06-02T12:17:43.000000Z","user_id":"6"}]}}'
6464
headers: []
6565
description: null
6666
-

config/scribe.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@
194194
/*
195195
* Set this to true if any endpoints in your API use authentication.
196196
*/
197-
'enabled' => false,
197+
'enabled' => true,
198198

199199
/*
200200
* Set this to true if your API should be authenticated by default. If so, you must also set `enabled` (above) to true.
@@ -230,7 +230,7 @@
230230
* Any extra authentication-related info for your users. For instance, you can describe how to find or generate their auth credentials.
231231
* Markdown and HTML are supported.
232232
*/
233-
'extra_info' => 'You can retrieve your token by visiting your dashboard and clicking <b>Generate API token</b>.',
233+
'extra_info' => 'You can retrieve your token by using the `users/auth` endpoint.',
234234
],
235235

236236
/*

docs/collection.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
],
1111
"info": {
1212
"name": "The SideProject API",
13-
"_postman_id": "853ce7e2-9158-4216-b6a9-cb651c4fb039",
13+
"_postman_id": "83ebb8f9-300a-499f-8343-f4af9197109f",
1414
"description": "Start (and never finish) side projects with this API.",
1515
"schema": "https:\/\/schema.getpostman.com\/json\/collection\/v2.1.0\/collection.json"
1616
},
@@ -156,7 +156,7 @@
156156
],
157157
"body": {
158158
"mode": "raw",
159-
"raw": "{\"name\":\"The SideProject API\",\"description\":\"ovsnvfcwodowljclfphodypoplikvyotjovrjudbmxqvvdlccjyfgdivsjtacjokurmwmxjffismejdaobevyfcbyleqjgqcoefmvdnrazszstfwulwyendppvmxeocdljwpxkslcereqwua\",\"url\":\"http:\\\/\\\/www.smitham.info\\\/consequatur-tempora-aspernatur-officiis-omnis-sed-similique.html\",\"due_at\":\"2077-09-25\"}"
159+
"raw": "{\"name\":\"The SideProject API\",\"description\":\"ovsnvfcwodowljclfphodypoplikvyotjovrjudbmxqvvdlccjyfgdivsjtacjokurmwmxjffismejdaobevyfcbyleqjgqcoefmvdnrazszstfwulwyendppvmxeocdljwpxkslcereqwua\",\"url\":\"http:\\\/\\\/www.smitham.info\\\/consequatur-tempora-aspernatur-officiis-omnis-sed-similique.html\",\"due_at\":\"2077-09-26\"}"
160160
},
161161
"description": "_Even though we both know you'll never finish it._\n\nThis endpoint's body parameters were automatically generated by Scribe\nfrom the controller's code. Check out the source! <\/aside>"
162162
},
@@ -197,7 +197,7 @@
197197
{
198198
"header": [],
199199
"code": 200,
200-
"body": "{\"data\":{\"name\":\"quo quo molestias\",\"description\":\"Tempora aspernatur officiis omnis sed similique et et.\",\"due_date\":\"20241229\",\"owner\":{\"id\":1,\"name\":\"Pete\",\"email\":\"[email protected]\",\"email_verified_at\":null,\"created_at\":\"2021-05-29T22:53:05.000000Z\",\"updated_at\":\"2021-05-29T22:53:05.000000Z\"}}}",
200+
"body": "{\"data\":{\"name\":\"quo quo molestias\",\"description\":\"Tempora aspernatur officiis omnis sed similique et et.\",\"due_date\":\"20241230\",\"owner\":{\"id\":1,\"name\":\"Pete\",\"email\":\"[email protected]\",\"email_verified_at\":null,\"created_at\":\"2021-05-29T22:53:05.000000Z\",\"updated_at\":\"2021-05-29T22:53:05.000000Z\"}}}",
201201
"name": null
202202
}
203203
]
@@ -337,7 +337,7 @@
337337
{
338338
"header": [],
339339
"code": 200,
340-
"body": "{\"data\":{\"id\":6,\"name\":\"Dr. Kallie Schroeder\",\"email\":\"[email protected]\",\"side_projects\":[{\"id\":10,\"name\":\"similique et et\",\"description\":\"Odit molestiae non est nostrum sunt.\",\"url\":null,\"due_at\":\"20221027\",\"created_at\":\"2021-06-01T16:38:10.000000Z\",\"updated_at\":\"2021-06-01T16:38:10.000000Z\",\"user_id\":\"6\"}]}}",
340+
"body": "{\"data\":{\"id\":6,\"name\":\"Dr. Kallie Schroeder\",\"email\":\"[email protected]\",\"side_projects\":[{\"id\":10,\"name\":\"similique et et\",\"description\":\"Odit molestiae non est nostrum sunt.\",\"url\":null,\"due_at\":\"20221027\",\"created_at\":\"2021-06-02T12:17:43.000000Z\",\"updated_at\":\"2021-06-02T12:17:43.000000Z\",\"user_id\":\"6\"}]}}",
341341
"name": null
342342
},
343343
{
@@ -458,6 +458,6 @@
458458
}
459459
],
460460
"auth": {
461-
"type": "noauth"
461+
"type": "bearer"
462462
}
463463
}

docs/index.html

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
<li><a href="openapi.yaml">View OpenAPI spec</a></li>
5454
</ul>
5555
<ul class="toc-footer" id="last-updated">
56-
<li>Last updated: June 1 2021</li>
56+
<li>Last updated: June 2 2021</li>
5757
</ul>
5858
</div>
5959
<div class="page-wrapper">
@@ -73,7 +73,9 @@ <h1>Introduction</h1>
7373
<pre><code class="language-yaml">http://testapi.com</code></pre>
7474

7575
<h1>Authenticating requests</h1>
76-
<p>This API is not authenticated.</p>
76+
<p>To authenticate requests, include an <strong><code>Authorization</code></strong> header with the value <strong><code>"Bearer {YOUR_AUTH_KEY}"</code></strong>.</p>
77+
<p>All authenticated endpoints are marked with a <code>requires authentication</code> badge in the documentation below.</p>
78+
<p>You can retrieve your token by using the <code>users/auth</code> endpoint.</p>
7779

7880
<h1 id="general">General</h1>
7981
<p>
@@ -477,15 +479,17 @@ <h2 id="side-projects-POSTapi-side_projects">Start a new side project</h2>
477479

478480
<pre><code class="language-bash">curl --request POST \
479481
"http://testapi.com/api/side_projects" \
482+
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
480483
--header "Content-Type: application/json" \
481484
--header "Accept: application/json" \
482-
--data "{\"name\":\"The SideProject API\",\"description\":\"ovsnvfcwodowljclfphodypoplikvyotjovrjudbmxqvvdlccjyfgdivsjtacjokurmwmxjffismejdaobevyfcbyleqjgqcoefmvdnrazszstfwulwyendppvmxeocdljwpxkslcereqwua\",\"url\":\"http:\\/\\/www.smitham.info\\/consequatur-tempora-aspernatur-officiis-omnis-sed-similique.html\",\"due_at\":\"2077-09-25\"}"</code></pre>
485+
--data "{\"name\":\"The SideProject API\",\"description\":\"ovsnvfcwodowljclfphodypoplikvyotjovrjudbmxqvvdlccjyfgdivsjtacjokurmwmxjffismejdaobevyfcbyleqjgqcoefmvdnrazszstfwulwyendppvmxeocdljwpxkslcereqwua\",\"url\":\"http:\\/\\/www.smitham.info\\/consequatur-tempora-aspernatur-officiis-omnis-sed-similique.html\",\"due_at\":\"2077-09-26\"}"</code></pre>
483486

484487
<pre><code class="language-javascript">const url = new URL(
485488
"http://testapi.com/api/side_projects"
486489
);
487490

488491
let headers = {
492+
"Authorization": "Bearer {YOUR_AUTH_KEY}",
489493
"Content-Type": "application/json",
490494
"Accept": "application/json",
491495
};
@@ -494,7 +498,7 @@ <h2 id="side-projects-POSTapi-side_projects">Start a new side project</h2>
494498
"name": "The SideProject API",
495499
"description": "ovsnvfcwodowljclfphodypoplikvyotjovrjudbmxqvvdlccjyfgdivsjtacjokurmwmxjffismejdaobevyfcbyleqjgqcoefmvdnrazszstfwulwyendppvmxeocdljwpxkslcereqwua",
496500
"url": "http:\/\/www.smitham.info\/consequatur-tempora-aspernatur-officiis-omnis-sed-similique.html",
497-
"due_at": "2077-09-25"
501+
"due_at": "2077-09-26"
498502
}
499503

500504
fetch(url, {
@@ -508,13 +512,14 @@ <h2 id="side-projects-POSTapi-side_projects">Start a new side project</h2>
508512
'http://testapi.com/api/side_projects',
509513
[
510514
'headers' =&gt; [
515+
'Authorization' =&gt; 'Bearer {YOUR_AUTH_KEY}',
511516
'Accept' =&gt; 'application/json',
512517
],
513518
'json' =&gt; [
514519
'name' =&gt; 'The SideProject API',
515520
'description' =&gt; 'ovsnvfcwodowljclfphodypoplikvyotjovrjudbmxqvvdlccjyfgdivsjtacjokurmwmxjffismejdaobevyfcbyleqjgqcoefmvdnrazszstfwulwyendppvmxeocdljwpxkslcereqwua',
516521
'url' =&gt; 'http://www.smitham.info/consequatur-tempora-aspernatur-officiis-omnis-sed-similique.html',
517-
'due_at' =&gt; '2077-09-25',
522+
'due_at' =&gt; '2077-09-26',
518523
],
519524
]
520525
);
@@ -529,9 +534,10 @@ <h2 id="side-projects-POSTapi-side_projects">Start a new side project</h2>
529534
"name": "The SideProject API",
530535
"description": "ovsnvfcwodowljclfphodypoplikvyotjovrjudbmxqvvdlccjyfgdivsjtacjokurmwmxjffismejdaobevyfcbyleqjgqcoefmvdnrazszstfwulwyendppvmxeocdljwpxkslcereqwua",
531536
"url": "http:\/\/www.smitham.info\/consequatur-tempora-aspernatur-officiis-omnis-sed-similique.html",
532-
"due_at": "2077-09-25"
537+
"due_at": "2077-09-26"
533538
}
534539
headers = {
540+
'Authorization': 'Bearer {YOUR_AUTH_KEY}',
535541
'Accept': 'application/json'
536542
}
537543

@@ -545,9 +551,10 @@ <h2 id="side-projects-POSTapi-side_projects">Start a new side project</h2>
545551
"name": "The SideProject API",
546552
"description": "ovsnvfcwodowljclfphodypoplikvyotjovrjudbmxqvvdlccjyfgdivsjtacjokurmwmxjffismejdaobevyfcbyleqjgqcoefmvdnrazszstfwulwyendppvmxeocdljwpxkslcereqwua",
547553
"url": "http:\/\/www.smitham.info\/consequatur-tempora-aspernatur-officiis-omnis-sed-similique.html",
548-
"due_at": "2077-09-25"
554+
"due_at": "2077-09-26"
549555
}
550556
headers = {
557+
"Authorization": "Bearer {YOUR_AUTH_KEY}",
551558
"Accept": "application/json",
552559
}
553560

@@ -574,7 +581,7 @@ <h2 id="side-projects-POSTapi-side_projects">Start a new side project</h2>
574581
data-path="api/side_projects"
575582
data-authed="1"
576583
data-hasfiles=""
577-
data-headers='{"Accept":"application\/json"}'
584+
data-headers='{"Authorization":"Bearer {YOUR_AUTH_KEY}","Accept":"application\/json"}'
578585
onsubmit="event.preventDefault(); executeTryOut('POSTapi-side_projects', this);">
579586
<h3>
580587
Request&nbsp;&nbsp;&nbsp;
@@ -708,7 +715,7 @@ <h2 id="side-projects-GETapi-side_projects--id-">View a side project</h2>
708715
&quot;data&quot;: {
709716
&quot;name&quot;: &quot;quo quo molestias&quot;,
710717
&quot;description&quot;: &quot;Tempora aspernatur officiis omnis sed similique et et.&quot;,
711-
&quot;due_date&quot;: &quot;20241229&quot;,
718+
&quot;due_date&quot;: &quot;20241230&quot;,
712719
&quot;owner&quot;: {
713720
&quot;id&quot;: 1,
714721
&quot;name&quot;: &quot;Pete&quot;,
@@ -1234,8 +1241,8 @@ <h2 id="users-GETapi-users--id-">Fetch a user</h2>
12341241
&quot;description&quot;: &quot;Odit molestiae non est nostrum sunt.&quot;,
12351242
&quot;url&quot;: null,
12361243
&quot;due_at&quot;: &quot;20221027&quot;,
1237-
&quot;created_at&quot;: &quot;2021-06-01T16:38:10.000000Z&quot;,
1238-
&quot;updated_at&quot;: &quot;2021-06-01T16:38:10.000000Z&quot;,
1244+
&quot;created_at&quot;: &quot;2021-06-02T12:17:43.000000Z&quot;,
1245+
&quot;updated_at&quot;: &quot;2021-06-02T12:17:43.000000Z&quot;,
12391246
&quot;user_id&quot;: &quot;6&quot;
12401247
}
12411248
]
@@ -1711,7 +1718,9 @@ <h4 class="fancy-heading-panel"><b>Response Fields</b></h4>
17111718
<p>The new API token. Valid forever.</p> </p>
17121719

17131720

1714-
1721+
<h1>Some extra info</h1>
1722+
<p>Just some extra info added via an <code>append.md</code> file.</p>
1723+
<p>Go on, <a href="https://github.com/knuckleswtf/scribe">go check Scribe out</a> 😄.</p>
17151724
</div>
17161725
<div class="dark-box">
17171726
<div class="lang-selector">

0 commit comments

Comments
 (0)