Skip to content

Commit

Permalink
Remove Content Type from headers Fixes #14
Browse files Browse the repository at this point in the history
  • Loading branch information
joegasewicz committed Jan 19, 2021
1 parent 529508e commit f39f09b
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 44 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Changelog

### Changed
**Releases 0.0.23** - This change effects content-type headers (Please make sure you do not rely on this library to add in these headers now!)

- Remove application/json Content Type from `createOAuthHeaders()` headers. [Issue #14](https://github.com/joegasewicz/react-google-oauth2.0/issues/14)


## Unreleased
23 changes: 14 additions & 9 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,24 +123,29 @@ <h2>Quick Start</h2>
<h3>GoogleAuth Provider &amp; GoogleAuthConsumer</h3>
</a>
<p>Get notified when a user has logged in successfully by wrapping the
<code>GoogleButton</code> component within the <code>GoogleAuth</code> provider. For example:</p>
<code>GoogleButton</code> component within the <code>GoogleAuth</code> provider.
You can then use the <code>GoogleAuthConsumer</code> to redirect to your authorized routes
when <code>{isAuthenticated}</code> is true.
For example:</p>
<pre><code class="language-typescript"><span class="hljs-keyword">import</span> {
GoogleAuth,
GoogleButton,
GoogleAuthConsumer,
} <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;react-google-oauth2&quot;</span>;

<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">GoogleAuth</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">GoogleButton</span>
<span class="hljs-attr">placeholder</span>=<span class="hljs-string">&quot;demo/search.png&quot;</span> // <span class="hljs-attr">Optional</span>
<span class="hljs-attr">options</span>=<span class="hljs-string">{options}</span>
<span class="hljs-attr">apiUrl</span>=<span class="hljs-string">&quot;http://localhost:5000/google_login&quot;</span>
<span class="hljs-attr">defaultStyle</span>=<span class="hljs-string">{true}</span> // <span class="hljs-attr">Optional</span>
<span class="hljs-attr">displayErrors</span>=<span class="hljs-string">{true}</span>&gt;</span>Sign in with google<span class="hljs-tag">&lt;/<span class="hljs-name">GoogleButton</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">GoogleAuthConsumer</span>&gt;</span>
{({isAuthenticated}: any) =&gt; {
console.log(&quot;isAuthenticated&quot;, isAuthenticated);
return null;
if (!isAuthenticated) {
return <span class="hljs-tag">&lt;<span class="hljs-name">GoogleButton</span>
<span class="hljs-attr">placeholder</span>=<span class="hljs-string">&quot;demo/search.png&quot;</span> // <span class="hljs-attr">Optional</span>
<span class="hljs-attr">options</span>=<span class="hljs-string">{options}</span>
<span class="hljs-attr">apiUrl</span>=<span class="hljs-string">&quot;http://localhost:5000/google_login&quot;</span>
<span class="hljs-attr">defaultStyle</span>=<span class="hljs-string">{true}</span> // <span class="hljs-attr">Optional</span>
<span class="hljs-attr">displayErrors</span>=<span class="hljs-string">{true}</span>&gt;</span>Sign in with google<span class="hljs-tag">&lt;/<span class="hljs-name">GoogleButton</span>&gt;</span>;
} else {
return <span class="hljs-tag">&lt;<span class="hljs-name">Redirect</span> <span class="hljs-attr">to</span>=<span class="hljs-string">&quot;/home&quot;</span> /&gt;</span>;
}
}}
<span class="hljs-tag">&lt;/<span class="hljs-name">GoogleAuthConsumer</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">GoogleAuth</span>&gt;</span></span>
Expand Down
16 changes: 8 additions & 8 deletions docs/interfaces/_authorization_.iauthorizationbase.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> access<wbr>Type</h3>
<div class="tsd-signature tsd-kind-icon">access<wbr>Type<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/91ac418/src/authorization.ts#L19">authorization.ts:19</a></li>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/529508e/src/authorization.ts#L19">authorization.ts:19</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -132,7 +132,7 @@ <h3>client<wbr>Id</h3>
<div class="tsd-signature tsd-kind-icon">client<wbr>Id<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/91ac418/src/authorization.ts#L8">authorization.ts:8</a></li>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/529508e/src/authorization.ts#L8">authorization.ts:8</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -147,7 +147,7 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> include<wbr>Granted<w
<div class="tsd-signature tsd-kind-icon">include<wbr>Granted<wbr>Scopes<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">false</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">true</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/91ac418/src/authorization.ts#L29">authorization.ts:29</a></li>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/529508e/src/authorization.ts#L29">authorization.ts:29</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -163,7 +163,7 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> login<wbr>Hint</h3>
<div class="tsd-signature tsd-kind-icon">login<wbr>Hint<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/91ac418/src/authorization.ts#L31">authorization.ts:31</a></li>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/529508e/src/authorization.ts#L31">authorization.ts:31</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -178,7 +178,7 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> prompt</h3>
<div class="tsd-signature tsd-kind-icon">prompt<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/91ac418/src/authorization.ts#L37">authorization.ts:37</a></li>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/529508e/src/authorization.ts#L37">authorization.ts:37</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -195,7 +195,7 @@ <h3>redirect<wbr>Uri</h3>
<div class="tsd-signature tsd-kind-icon">redirect<wbr>Uri<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/91ac418/src/authorization.ts#L10">authorization.ts:10</a></li>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/529508e/src/authorization.ts#L10">authorization.ts:10</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -210,7 +210,7 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> response<wbr>Type</h3
<div class="tsd-signature tsd-kind-icon">response<wbr>Type<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/91ac418/src/authorization.ts#L12">authorization.ts:12</a></li>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/529508e/src/authorization.ts#L12">authorization.ts:12</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -225,7 +225,7 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> state</h3>
<div class="tsd-signature tsd-kind-icon">state<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/91ac418/src/authorization.ts#L24">authorization.ts:24</a></li>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/529508e/src/authorization.ts#L24">authorization.ts:24</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down
18 changes: 9 additions & 9 deletions docs/interfaces/_authorization_.iauthorizationoptions.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> access<wbr>Type</h3>
<aside class="tsd-sources">
<p>Inherited from <a href="_authorization_.iauthorizationbase.html">IAuthorizationBase</a>.<a href="_authorization_.iauthorizationbase.html#accesstype">accessType</a></p>
<ul>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/91ac418/src/authorization.ts#L19">authorization.ts:19</a></li>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/529508e/src/authorization.ts#L19">authorization.ts:19</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -135,7 +135,7 @@ <h3>client<wbr>Id</h3>
<aside class="tsd-sources">
<p>Inherited from <a href="_authorization_.iauthorizationbase.html">IAuthorizationBase</a>.<a href="_authorization_.iauthorizationbase.html#clientid">clientId</a></p>
<ul>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/91ac418/src/authorization.ts#L8">authorization.ts:8</a></li>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/529508e/src/authorization.ts#L8">authorization.ts:8</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -151,7 +151,7 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> include<wbr>Granted<w
<aside class="tsd-sources">
<p>Inherited from <a href="_authorization_.iauthorizationbase.html">IAuthorizationBase</a>.<a href="_authorization_.iauthorizationbase.html#includegrantedscopes">includeGrantedScopes</a></p>
<ul>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/91ac418/src/authorization.ts#L29">authorization.ts:29</a></li>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/529508e/src/authorization.ts#L29">authorization.ts:29</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -168,7 +168,7 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> login<wbr>Hint</h3>
<aside class="tsd-sources">
<p>Inherited from <a href="_authorization_.iauthorizationbase.html">IAuthorizationBase</a>.<a href="_authorization_.iauthorizationbase.html#loginhint">loginHint</a></p>
<ul>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/91ac418/src/authorization.ts#L31">authorization.ts:31</a></li>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/529508e/src/authorization.ts#L31">authorization.ts:31</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -184,7 +184,7 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> prompt</h3>
<aside class="tsd-sources">
<p>Inherited from <a href="_authorization_.iauthorizationbase.html">IAuthorizationBase</a>.<a href="_authorization_.iauthorizationbase.html#prompt">prompt</a></p>
<ul>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/91ac418/src/authorization.ts#L37">authorization.ts:37</a></li>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/529508e/src/authorization.ts#L37">authorization.ts:37</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -202,7 +202,7 @@ <h3>redirect<wbr>Uri</h3>
<aside class="tsd-sources">
<p>Inherited from <a href="_authorization_.iauthorizationbase.html">IAuthorizationBase</a>.<a href="_authorization_.iauthorizationbase.html#redirecturi">redirectUri</a></p>
<ul>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/91ac418/src/authorization.ts#L10">authorization.ts:10</a></li>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/529508e/src/authorization.ts#L10">authorization.ts:10</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -218,7 +218,7 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> response<wbr>Type</h3
<aside class="tsd-sources">
<p>Inherited from <a href="_authorization_.iauthorizationbase.html">IAuthorizationBase</a>.<a href="_authorization_.iauthorizationbase.html#responsetype">responseType</a></p>
<ul>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/91ac418/src/authorization.ts#L12">authorization.ts:12</a></li>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/529508e/src/authorization.ts#L12">authorization.ts:12</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -233,7 +233,7 @@ <h3>scopes</h3>
<div class="tsd-signature tsd-kind-icon">scopes<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Array</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/91ac418/src/authorization.ts#L41">authorization.ts:41</a></li>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/529508e/src/authorization.ts#L41">authorization.ts:41</a></li>
</ul>
</aside>
</section>
Expand All @@ -244,7 +244,7 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> state</h3>
<aside class="tsd-sources">
<p>Inherited from <a href="_authorization_.iauthorizationbase.html">IAuthorizationBase</a>.<a href="_authorization_.iauthorizationbase.html#state">state</a></p>
<ul>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/91ac418/src/authorization.ts#L24">authorization.ts:24</a></li>
<li>Defined in <a href="https://github.com/joegasewicz/react-google-oauth2.0/blob/529508e/src/authorization.ts#L24">authorization.ts:24</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down
Loading

0 comments on commit f39f09b

Please sign in to comment.