Skip to content

Commit 6107208

Browse files
authored
Add documentation for using Authorisation headers in rake taks (#40)
* add documentation for graphiti-api/graphiti-rails#70 * fix typo * fix typo: Authorisation -> Authorization
1 parent 79f3d55 commit 6107208

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

_site/guides/concepts/debugging.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ <h1 id="debugging">Debugging</h1>
9494
<ul>
9595
<li><a href="#graphiti-request">graphiti:request</a></li>
9696
<li><a href="#graphiti-benchmark">graphiti:benchmark</a></li>
97+
<li><a href="#Authorization-headers">Authorization headers</a></li>
9798
</ul>
9899
</li>
99100
<li>3 <a href="#tips">Tips</a></li>
@@ -301,6 +302,20 @@ <h4>
301302

302303
<p>Which will return the average response time.</p>
303304

305+
<a class="anchor" id="Authorization-headers" />
306+
<a class="header" href="#Authorization-headers">
307+
<h4>
308+
2.3 Authorization headers
309+
</h4>
310+
</a>
311+
312+
<p>If you have an Authorization scheme implemented (for example <a href="https://api.rubyonrails.org/classes/ActionController/HttpAuthentication/Token.html">authenticate_or_request_with_http_token</a> in rails) you can supply the <code class="highlighter-rouge">Authorization</code> http header value with the <code class="highlighter-rouge">AUTHORIZATION_HEADER</code> environment variable:</p>
313+
314+
<figure class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="gp">$ </span><span class="nb">export </span><span class="nv">AUTHORIZATION_HEADER</span><span class="o">=</span><span class="s2">"Token --PRIVATE_API_KEY--"</span>
315+
<span class="gp">$ </span>bin/rake graphiti:request[/employees,true]</code></pre></figure>
316+
317+
<p>This also will work for <code class="highlighter-rouge">Basic</code> (<a href="https://api.rubyonrails.org/classes/ActionController/HttpAuthentication/Basic.html$$">request_http_basic_authentication</a>) and <code class="highlighter-rouge">Bearer</code> values</p>
318+
304319
<a class="anchor" id="tips" />
305320
<a class="header" href="#tips">
306321
<h2>

guides/concepts/debugging.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Debugging
1212
* 2 [Rake Tasks](#rake-tasks)
1313
* [graphiti:request](#graphiti-request)
1414
* [graphiti:benchmark](#graphiti-benchmark)
15+
* [Authorization headers](#Authorization-headers)
1516
* 3 [Tips](#tips)
1617

1718
</div>
@@ -202,6 +203,17 @@ $ bin/rake graphiti:benchmark[/employees,100]
202203

203204
Which will return the average response time.
204205

206+
{% include h.html tag="h4" text="2.3 Authorization headers" a="Authorization-headers" %}
207+
208+
If you have an Authorization scheme implemented (for example [authenticate_or_request_with_http_token](https://api.rubyonrails.org/classes/ActionController/HttpAuthentication/Token.html) in rails) you can supply the `Authorization` http header value with the `AUTHORIZATION_HEADER` environment variable:
209+
210+
{% highlight bash %}
211+
$ export AUTHORIZATION_HEADER="Token --PRIVATE_API_KEY--"
212+
$ bin/rake graphiti:request[/employees,true]
213+
{% endhighlight %}
214+
215+
This also will work for `Basic` ([request_http_basic_authentication](https://api.rubyonrails.org/classes/ActionController/HttpAuthentication/Basic.html$$)) and `Bearer` values
216+
205217
{% include h.html tag="h2" text="3 Tips" a="tips" %}
206218

207219
When debugging an application, try to isolate the individual Resource

0 commit comments

Comments
 (0)