├── .all-contributorsrc ├── .gitignore ├── .prettierrc.json ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── auth0.js ├── dist ├── AuthConfig.d.ts ├── AuthProvider.d.ts ├── NetlifyIdentity.esm.js ├── NetlifyIdentity.esm.js.map ├── NetlifyIdentity.js ├── NetlifyIdentity.js.map ├── NetlifyIdentity.modern.js ├── NetlifyIdentity.modern.js.map ├── NetlifyIdentity.umd.js ├── NetlifyIdentity.umd.js.map ├── auth0.esm.js ├── auth0.esm.js.map ├── auth0.js ├── auth0.js.map ├── auth0.modern.js ├── auth0.modern.js.map ├── auth0.umd.js ├── auth0.umd.js.map ├── authReducer.d.ts ├── index.d.ts ├── providers │ ├── NetlifyIdentity.d.ts │ ├── auth0.d.ts │ └── index.d.ts ├── react-use-auth.esm.js ├── react-use-auth.esm.js.map ├── react-use-auth.js ├── react-use-auth.js.map ├── react-use-auth.modern.js ├── react-use-auth.modern.js.map ├── react-use-auth.umd.js ├── react-use-auth.umd.js.map ├── types.d.ts └── useAuth.d.ts ├── examples ├── gatsby-V2 │ ├── LICENSE │ ├── README.md │ ├── font-preload-cache.json │ ├── gatsby-browser.js │ ├── gatsby-config.js │ ├── gatsby-node.js │ ├── gatsby-ssr.js │ ├── jsconfig.json │ ├── package.json │ ├── public │ │ ├── 404 │ │ │ └── index.html │ │ ├── 3bf2bbaa46a3d4fc8b48bd922633083fb4d6d6ce-db1d5b5ecca700c7cf25.js │ │ ├── 3bf2bbaa46a3d4fc8b48bd922633083fb4d6d6ce-db1d5b5ecca700c7cf25.js.map │ │ ├── 404.html │ │ ├── 8e82a8285a059e40172b3fce3456b4d513f6f72a-578946d2e6fad0f3e98f.js │ │ ├── 8e82a8285a059e40172b3fce3456b4d513f6f72a-578946d2e6fad0f3e98f.js.map │ │ ├── 9e82d048-510a147398e950707384.js │ │ ├── 9e82d048-510a147398e950707384.js.map │ │ ├── app-d1c198c391345cb7546f.js │ │ ├── app-d1c198c391345cb7546f.js.map │ │ ├── auth0_callback │ │ │ └── index.html │ │ ├── chunk-map.json │ │ ├── component---src-pages-404-js-670d78c077072ad10c98.js │ │ ├── component---src-pages-404-js-670d78c077072ad10c98.js.map │ │ ├── component---src-pages-auth-0-callback-js-43c5d91e91b0ce57c4a5.js │ │ ├── component---src-pages-auth-0-callback-js-43c5d91e91b0ce57c4a5.js.map │ │ ├── component---src-pages-docs-auth-mdx-8a523fea82b58e688a94.js │ │ ├── component---src-pages-docs-auth-mdx-8a523fea82b58e688a94.js.map │ │ ├── component---src-pages-docs-callback-mdx-12c8e7ed8599ad0f8a79.js │ │ ├── component---src-pages-docs-callback-mdx-12c8e7ed8599ad0f8a79.js.map │ │ ├── component---src-pages-docs-enjoy-mdx-5d76df1dde88425fc86e.js │ │ ├── component---src-pages-docs-enjoy-mdx-5d76df1dde88425fc86e.js.map │ │ ├── component---src-pages-docs-getting-started-mdx-9d1444ad087d61d15115.js │ │ ├── component---src-pages-docs-getting-started-mdx-9d1444ad087d61d15115.js.map │ │ ├── component---src-pages-index-js-4a86f52f350c1cc5ec08.js │ │ ├── component---src-pages-index-js-4a86f52f350c1cc5ec08.js.map │ │ ├── docs │ │ │ ├── auth │ │ │ │ └── index.html │ │ │ ├── callback │ │ │ │ └── index.html │ │ │ ├── enjoy │ │ │ │ └── index.html │ │ │ └── getting-started │ │ │ │ └── index.html │ │ ├── framework-3321703c33570853116c.js │ │ ├── framework-3321703c33570853116c.js.map │ │ ├── icons │ │ │ ├── icon-144x144.png │ │ │ ├── icon-192x192.png │ │ │ ├── icon-256x256.png │ │ │ ├── icon-384x384.png │ │ │ ├── icon-48x48.png │ │ │ ├── icon-512x512.png │ │ │ ├── icon-72x72.png │ │ │ └── icon-96x96.png │ │ ├── index.html │ │ ├── manifest.webmanifest │ │ ├── page-data │ │ │ ├── 404 │ │ │ │ └── page-data.json │ │ │ ├── 404.html │ │ │ │ └── page-data.json │ │ │ ├── app-data.json │ │ │ ├── auth0_callback │ │ │ │ └── page-data.json │ │ │ ├── callback │ │ │ │ └── page-data.json │ │ │ ├── dev-404-page │ │ │ │ └── page-data.json │ │ │ ├── docs │ │ │ │ ├── auth │ │ │ │ │ └── page-data.json │ │ │ │ ├── callback │ │ │ │ │ └── page-data.json │ │ │ │ ├── enjoy │ │ │ │ │ └── page-data.json │ │ │ │ ├── getting-started │ │ │ │ │ └── page-data.json │ │ │ │ └── test │ │ │ │ │ └── page-data.json │ │ │ └── index │ │ │ │ └── page-data.json │ │ ├── static │ │ │ ├── 6d91c86c0fde632ba4cd01062fd9ccfa │ │ │ │ ├── 2a4de │ │ │ │ │ └── gatsby-astronaut.png │ │ │ │ ├── 5db04 │ │ │ │ │ └── gatsby-astronaut.png │ │ │ │ ├── 62b1f │ │ │ │ │ └── gatsby-astronaut.png │ │ │ │ ├── 630fb │ │ │ │ │ └── gatsby-astronaut.png │ │ │ │ ├── 6d161 │ │ │ │ │ └── gatsby-astronaut.png │ │ │ │ └── ee604 │ │ │ │ │ └── gatsby-astronaut.png │ │ │ └── d │ │ │ │ ├── 2417117884.json │ │ │ │ ├── 2969191536.json │ │ │ │ └── 856328897.json │ │ ├── webpack-runtime-37f1cbc6cebaadfe94d8.js │ │ ├── webpack-runtime-37f1cbc6cebaadfe94d8.js.map │ │ └── webpack.stats.json │ ├── src │ │ ├── components │ │ │ ├── docsLayout.js │ │ │ ├── gatsby-plugin-chakra-ui │ │ │ │ ├── CustomColor.js │ │ │ │ └── theme.js │ │ │ ├── header.js │ │ │ ├── layout.js │ │ │ └── seo.js │ │ ├── images │ │ │ ├── gatsby-astronaut.png │ │ │ └── gatsby-icon.png │ │ ├── pages │ │ │ ├── 404.js │ │ │ ├── auth0_callback.js │ │ │ ├── docs │ │ │ │ ├── auth.mdx │ │ │ │ ├── callback.mdx │ │ │ │ ├── enjoy.mdx │ │ │ │ └── getting-started.mdx │ │ │ └── index.js │ │ └── styled │ │ │ └── headerStyles.js │ ├── yarn-error.log │ └── yarn.lock ├── useAuth.dev │ ├── .gitignore │ ├── LICENSE.MD │ ├── README.md │ ├── gatsby-browser.js │ ├── gatsby-config.js │ ├── gatsby-node.js │ ├── gatsby-ssr.js │ ├── package.json │ ├── src │ │ ├── components │ │ │ ├── banner.js │ │ │ ├── button.js │ │ │ ├── cards.js │ │ │ ├── code.js │ │ │ ├── debug-theme.js │ │ │ ├── edit-link.js │ │ │ ├── head.js │ │ │ ├── intro.js │ │ │ ├── layout.js │ │ │ ├── menu-button.js │ │ │ ├── nav-link.js │ │ │ ├── note.js │ │ │ ├── pagination.js │ │ │ ├── select.js │ │ │ ├── skip-link.js │ │ │ ├── theme-scales.js │ │ │ ├── tiles.js │ │ │ └── typography-layout.js │ │ ├── gatsby-plugin-theme-ui │ │ │ ├── components.js │ │ │ └── index.js │ │ ├── index.js │ │ ├── pages │ │ │ ├── 404.mdx │ │ │ ├── Introduction.mdx │ │ │ ├── auth0_callback.js │ │ │ ├── docs │ │ │ │ ├── api-reference.mdx │ │ │ │ ├── auth-providers.mdx │ │ │ │ ├── auth.mdx │ │ │ │ ├── auth0.mdx │ │ │ │ ├── callback.mdx │ │ │ │ ├── enjoy.mdx │ │ │ │ ├── getting-started.mdx │ │ │ │ ├── images │ │ │ │ │ ├── auth0-application.png │ │ │ │ │ ├── auth0-callback-url.png │ │ │ │ │ ├── auth0-logout-url.png │ │ │ │ │ ├── auth0-rules.png │ │ │ │ │ ├── auth0-settings.png │ │ │ │ │ ├── auth0-web-origins.png │ │ │ │ │ ├── netlify-identity-roles.png │ │ │ │ │ ├── netlify-identity-widget.png │ │ │ │ │ ├── netlify-identity.png │ │ │ │ │ └── xstate-machine.png │ │ │ │ ├── netlify-identity.mdx │ │ │ │ ├── roles-auth0.mdx │ │ │ │ ├── roles-netlify-identity.mdx │ │ │ │ ├── roles.mdx │ │ │ │ └── upgrading.mdx │ │ │ └── index.mdx │ │ └── sidebar.mdx │ ├── static │ │ ├── auth0-flow.gif │ │ ├── icon.png │ │ └── useauth-card.png │ └── yarn.lock ├── useauth-create-next-app │ ├── .gitignore │ ├── components │ │ └── nav.js │ ├── package.json │ ├── pages │ │ ├── _app.js │ │ ├── auth0_callback.js │ │ └── index.js │ ├── static │ │ └── favicon.ico │ └── yarn.lock ├── useauth-create-react-app │ ├── .gitignore │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── public │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── logo192.png │ │ ├── logo512.png │ │ ├── manifest.json │ │ └── robots.txt │ ├── src │ │ ├── App.css │ │ ├── App.js │ │ ├── App.test.js │ │ ├── index.css │ │ ├── index.js │ │ ├── logo.svg │ │ ├── pages │ │ │ ├── AUTHCallback.jsx │ │ │ └── Home.jsx │ │ └── serviceWorker.js │ └── yarn.lock ├── useauth-gatsby-auth0 │ ├── .gitignore │ ├── .prettierrc │ ├── .vscode │ │ └── settings.json │ ├── LICENSE │ ├── README.md │ ├── gatsby-browser.js │ ├── gatsby-config.js │ ├── gatsby-node.js │ ├── gatsby-ssr.js │ ├── now.json │ ├── package.json │ ├── src │ │ ├── components │ │ │ ├── header.js │ │ │ ├── image.js │ │ │ ├── layout.css │ │ │ ├── layout.js │ │ │ └── seo.js │ │ ├── images │ │ │ ├── gatsby-astronaut.png │ │ │ └── gatsby-icon.png │ │ └── pages │ │ │ ├── 404.js │ │ │ ├── auth0_callback.js │ │ │ ├── index.js │ │ │ └── page-2.js │ └── yarn.lock └── useauth-gatsby-netlify-identity │ ├── .gitignore │ ├── .prettierignore │ ├── .prettierrc │ ├── LICENSE │ ├── README.md │ ├── gatsby-browser.js │ ├── gatsby-config.js │ ├── gatsby-node.js │ ├── gatsby-ssr.js │ ├── package.json │ ├── src │ ├── components │ │ ├── header.js │ │ ├── image.js │ │ ├── layout.css │ │ ├── layout.js │ │ └── seo.js │ ├── images │ │ ├── gatsby-astronaut.png │ │ └── gatsby-icon.png │ └── pages │ │ ├── 404.js │ │ ├── index.js │ │ ├── page-2.js │ │ └── using-typescript.tsx │ └── yarn.lock ├── jest.config.js ├── netlify-identity.js ├── package.json ├── src ├── AuthConfig.tsx ├── AuthProvider.tsx ├── __tests__ │ ├── AuthConfig.spec.tsx │ ├── authReducer.spec.ts │ └── useAuth.spec.tsx ├── authReducer.ts ├── index.ts ├── providers │ ├── NetlifyIdentity.ts │ ├── auth0.ts │ └── index.ts ├── types.ts └── useAuth.ts ├── tsconfig.json └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .rts2_cache* 3 | dist/__tests__ 4 | .cache 5 | examples/**/public 6 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "none", 3 | "tabWidth": 4, 4 | "semi": true, 5 | "singleQuote": false, 6 | "printWidth": 80 7 | } 8 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 2 | # Contributing to useAuth 3 | 4 | All contributions welcome ❤️ Bugs, docs, PRs with new features. We want it all. Project follows the [All Contributors](https://allcontributors.org/docs/en/bot/usage) spec. 5 | 6 | Most needed contributions right now: 7 | 8 | - **more examples** Using `useAuth` in a cool new way, with a different router, or React framework? Consider contributing an example project 9 | 10 | - **more auth providers** Right now `useAuth` only supports Auth0 and we'd love to support other providers. Perhaps even a way to use your own custom-built auth provider, that would be cool. 11 | 12 | ## Add yourself to contributors 13 | 14 | We follow the [All Contributors](https://allcontributors.org/docs/en/bot/usage) spec to give credit to everyone. Just mention someone and they'll be added as a contributor. 15 | 16 | `@all-contributors please add @example for X` -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Swizec Teller 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /auth0.js: -------------------------------------------------------------------------------- 1 | // this is a hack to improve DX 2 | // TODO: figure out a better way 3 | 4 | const { Auth0 } = require("./dist/auth0") 5 | module.exports = { Auth0 } 6 | -------------------------------------------------------------------------------- /dist/AuthConfig.d.ts: -------------------------------------------------------------------------------- 1 | import { AuthConfigInterface } from "./types"; 2 | export declare const AuthConfig: AuthConfigInterface; 3 | -------------------------------------------------------------------------------- /dist/AuthProvider.d.ts: -------------------------------------------------------------------------------- 1 | import { AuthProviderInterface } from "./types"; 2 | export declare const AuthProvider: AuthProviderInterface; 3 | -------------------------------------------------------------------------------- /dist/NetlifyIdentity.esm.js: -------------------------------------------------------------------------------- 1 | import t from"netlify-identity-widget";var n=function(){function n(n){var e=this;this.dispatch=n.dispatch,this.netlifyIdentity=t,this.netlifyIdentity.init(n),this.netlifyIdentity.on("error",function(t){e.dispatch("ERROR",{error:t,errorType:"netlifyError"})}),this.netlifyIdentity.on("login",function(t){var n;e.dispatch("AUTHENTICATED",{user:t,authResult:{expiresIn:null==(n=t.token)?void 0:n.expires_in}})}),this.netlifyIdentity.on("init",function(t){var n;t&&(e.dispatch("LOGIN"),e.dispatch("AUTHENTICATED",{user:t,authResult:{expiresIn:null==(n=t.token)?void 0:n.expires_in}}))})}n.addDefaultParams=function(t,n){return void 0===t&&(t={}),t};var e=n.prototype;return e.authorize=function(){this.dispatch("LOGIN"),this.netlifyIdentity.open("login")},e.signup=function(){this.dispatch("LOGIN"),this.netlifyIdentity.open("signup")},e.logout=function(t){this.netlifyIdentity.logout()},e.handleLoginCallback=function(t){try{return console.warn("handleLoginCallback is unnecessary with Netlify Identity Widget"),Promise.resolve(!0)}catch(t){return Promise.reject(t)}},e.checkSession=function(){try{var t=this,n=function(n){var e,i=t.netlifyIdentity.currentUser();if(i)return{user:i,authResult:{expiresIn:null==(e=i.token)?void 0:e.expires_in}};throw new Error("Session invalid")},e=function(n,e){try{var i=Promise.resolve(t.netlifyIdentity.refresh()).then(function(){})}catch(t){return e()}return i&&i.then?i.then(void 0,e):i}(0,function(){throw new Error("Session invalid")});return Promise.resolve(e&&e.then?e.then(n):n())}catch(t){return Promise.reject(t)}},e.userId=function(t){return t.id},e.userRoles=function(t){return t.app_metadata.roles},n}();export{n as NetlifyIdentity}; 2 | //# sourceMappingURL=NetlifyIdentity.esm.js.map 3 | -------------------------------------------------------------------------------- /dist/NetlifyIdentity.js: -------------------------------------------------------------------------------- 1 | function t(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var e=t(require("netlify-identity-widget"));exports.NetlifyIdentity=function(){function t(t){var n=this;this.dispatch=t.dispatch,this.netlifyIdentity=e.default,this.netlifyIdentity.init(t),this.netlifyIdentity.on("error",function(t){n.dispatch("ERROR",{error:t,errorType:"netlifyError"})}),this.netlifyIdentity.on("login",function(t){var e;n.dispatch("AUTHENTICATED",{user:t,authResult:{expiresIn:null==(e=t.token)?void 0:e.expires_in}})}),this.netlifyIdentity.on("init",function(t){var e;t&&(n.dispatch("LOGIN"),n.dispatch("AUTHENTICATED",{user:t,authResult:{expiresIn:null==(e=t.token)?void 0:e.expires_in}}))})}t.addDefaultParams=function(t,e){return void 0===t&&(t={}),t};var n=t.prototype;return n.authorize=function(){this.dispatch("LOGIN"),this.netlifyIdentity.open("login")},n.signup=function(){this.dispatch("LOGIN"),this.netlifyIdentity.open("signup")},n.logout=function(t){this.netlifyIdentity.logout()},n.handleLoginCallback=function(t){try{return console.warn("handleLoginCallback is unnecessary with Netlify Identity Widget"),Promise.resolve(!0)}catch(t){return Promise.reject(t)}},n.checkSession=function(){try{var t=this,e=function(e){var n,i=t.netlifyIdentity.currentUser();if(i)return{user:i,authResult:{expiresIn:null==(n=i.token)?void 0:n.expires_in}};throw new Error("Session invalid")},n=function(e,n){try{var i=Promise.resolve(t.netlifyIdentity.refresh()).then(function(){})}catch(t){return n()}return i&&i.then?i.then(void 0,n):i}(0,function(){throw new Error("Session invalid")});return Promise.resolve(n&&n.then?n.then(e):e())}catch(t){return Promise.reject(t)}},n.userId=function(t){return t.id},n.userRoles=function(t){return t.app_metadata.roles},t}(); 2 | //# sourceMappingURL=NetlifyIdentity.js.map 3 | -------------------------------------------------------------------------------- /dist/NetlifyIdentity.modern.js: -------------------------------------------------------------------------------- 1 | import t from"netlify-identity-widget";class i{constructor(i){this.dispatch=i.dispatch,this.netlifyIdentity=t,this.netlifyIdentity.init(i),this.netlifyIdentity.on("error",t=>{this.dispatch("ERROR",{error:t,errorType:"netlifyError"})}),this.netlifyIdentity.on("login",t=>{var i;this.dispatch("AUTHENTICATED",{user:t,authResult:{expiresIn:null==(i=t.token)?void 0:i.expires_in}})}),this.netlifyIdentity.on("init",t=>{var i;t&&(this.dispatch("LOGIN"),this.dispatch("AUTHENTICATED",{user:t,authResult:{expiresIn:null==(i=t.token)?void 0:i.expires_in}}))})}static addDefaultParams(t={},i){return t}authorize(){this.dispatch("LOGIN"),this.netlifyIdentity.open("login")}signup(){this.dispatch("LOGIN"),this.netlifyIdentity.open("signup")}logout(t){this.netlifyIdentity.logout()}async handleLoginCallback(t){return console.warn("handleLoginCallback is unnecessary with Netlify Identity Widget"),!0}async checkSession(){try{await this.netlifyIdentity.refresh()}catch(t){throw new Error("Session invalid")}const t=this.netlifyIdentity.currentUser();var i;if(t)return{user:t,authResult:{expiresIn:null==(i=t.token)?void 0:i.expires_in}};throw new Error("Session invalid")}userId(t){return t.id}userRoles(t){return t.app_metadata.roles}}export{i as NetlifyIdentity}; 2 | //# sourceMappingURL=NetlifyIdentity.modern.js.map 3 | -------------------------------------------------------------------------------- /dist/NetlifyIdentity.modern.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"NetlifyIdentity.modern.js","sources":["../src/providers/NetlifyIdentity.ts"],"sourcesContent":["import { AuthOptions, AuthProviderClass, ProviderOptions } from \"../types\";\nimport NetlifyWidget, { User, InitOptions } from \"netlify-identity-widget\";\n\n// Wrapper for NetlifyIdentity conforming to auth provider interface\nexport class NetlifyIdentity implements AuthProviderClass {\n private netlifyIdentity: any;\n private dispatch: (eventName: string, eventData?: any) => void;\n\n constructor(params: AuthOptions) {\n this.dispatch = params.dispatch;\n\n this.netlifyIdentity = NetlifyWidget;\n\n this.netlifyIdentity.init(params as InitOptions);\n\n this.netlifyIdentity.on(\"error\", (error: Error) => {\n this.dispatch(\"ERROR\", {\n error,\n errorType: \"netlifyError\"\n });\n });\n this.netlifyIdentity.on(\"login\", (user: User) => {\n this.dispatch(\"AUTHENTICATED\", {\n user,\n authResult: {\n expiresIn: user.token?.expires_in\n }\n });\n });\n this.netlifyIdentity.on(\"init\", (user: User) => {\n if (user) {\n this.dispatch(\"LOGIN\");\n this.dispatch(\"AUTHENTICATED\", {\n user,\n authResult: {\n expiresIn: user.token?.expires_in\n }\n });\n }\n });\n }\n\n static addDefaultParams(\n params: ProviderOptions = {},\n callbackDomain: string\n ) {\n const vals = params as InitOptions;\n return vals;\n }\n\n // Opens login dialog\n public authorize() {\n this.dispatch(\"LOGIN\");\n this.netlifyIdentity.open(\"login\");\n }\n\n // Opens signup dialog\n public signup() {\n this.dispatch(\"LOGIN\");\n this.netlifyIdentity.open(\"signup\");\n }\n\n // Logs user out on the underlying service\n public logout(returnTo?: string) {\n this.netlifyIdentity.logout();\n }\n\n // Handles login after redirect back from service\n public async handleLoginCallback(dispatch: any): Promise {\n console.warn(\n \"handleLoginCallback is unnecessary with Netlify Identity Widget\"\n );\n return true;\n }\n\n // verifies session is still valid\n // returns fresh user info\n public async checkSession(): Promise<{\n user: any;\n authResult: any;\n }> {\n try {\n await this.netlifyIdentity.refresh();\n } catch (e) {\n throw new Error(\"Session invalid\");\n }\n\n const user = this.netlifyIdentity.currentUser();\n\n if (user) {\n return {\n user,\n authResult: {\n expiresIn: user.token?.expires_in\n }\n };\n } else {\n throw new Error(\"Session invalid\");\n }\n }\n\n // Returns the userId from NetlifyIdentity shape of data\n public userId(user: User): string {\n return user.id;\n }\n\n // Returns user roles from NetlifyIdentity shape of data\n public userRoles(user: User): string[] | null {\n return user.app_metadata.roles;\n }\n}\n"],"names":["NetlifyIdentity","constructor","params","this","dispatch","netlifyIdentity","NetlifyWidget","init","on","error","errorType","user","authResult","expiresIn","token","_user$token","expires_in","_user$token2","[object Object]","callbackDomain","authorize","open","signup","logout","returnTo","console","warn","refresh","e","Error","currentUser","_user$token3","userId","id","userRoles","app_metadata","roles"],"mappings":"6CAIaA,EAITC,YAAYC,GACRC,KAAKC,SAAWF,EAAOE,SAEvBD,KAAKE,gBAAkBC,EAEvBH,KAAKE,gBAAgBE,KAAKL,GAE1BC,KAAKE,gBAAgBG,GAAG,QAAUC,IAC9BN,KAAKC,SAAS,QAAS,CACnBK,MAAAA,EACAC,UAAW,mBAGnBP,KAAKE,gBAAgBG,GAAG,QAAUG,UAC9BR,KAAKC,SAAS,gBAAiB,CAC3BO,KAAAA,EACAC,WAAY,CACRC,mBAAWF,EAAKG,cAALC,EAAYC,gBAInCb,KAAKE,gBAAgBG,GAAG,OAASG,UACzBA,IACAR,KAAKC,SAAS,SACdD,KAAKC,SAAS,gBAAiB,CAC3BO,KAAAA,EACAC,WAAY,CACRC,mBAAWF,EAAKG,cAALG,EAAYD,iBAO3CE,wBACIhB,EAA0B,GAC1BiB,GAGA,OADajB,EAKVkB,YACHjB,KAAKC,SAAS,SACdD,KAAKE,gBAAgBgB,KAAK,SAIvBC,SACHnB,KAAKC,SAAS,SACdD,KAAKE,gBAAgBgB,KAAK,UAIvBE,OAAOC,GACVrB,KAAKE,gBAAgBkB,SAIlBL,0BAA0Bd,GAI7B,OAHAqB,QAAQC,KACJ,sEAODR,qBAIH,eACeb,gBAAgBsB,UAC7B,MAAOC,GACL,UAAUC,MAAM,mBAGpB,MAAMlB,EAAOR,KAAKE,gBAAgByB,oBAElC,GAAInB,EACA,MAAO,CACHA,KAAAA,EACAC,WAAY,CACRC,mBAAWF,EAAKG,cAALiB,EAAYf,aAI/B,UAAUa,MAAM,mBAKjBG,OAAOrB,GACV,OAAOA,EAAKsB,GAITC,UAAUvB,GACb,OAAOA,EAAKwB,aAAaC"} -------------------------------------------------------------------------------- /dist/NetlifyIdentity.umd.js: -------------------------------------------------------------------------------- 1 | !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("netlify-identity-widget")):"function"==typeof define&&define.amd?define(["exports","netlify-identity-widget"],e):e((t||self).reactUseAuth={},t.netlifyIdentityWidget)}(this,function(t,e){function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=n(e);t.NetlifyIdentity=function(){function t(t){var e=this;this.dispatch=t.dispatch,this.netlifyIdentity=i.default,this.netlifyIdentity.init(t),this.netlifyIdentity.on("error",function(t){e.dispatch("ERROR",{error:t,errorType:"netlifyError"})}),this.netlifyIdentity.on("login",function(t){var n;e.dispatch("AUTHENTICATED",{user:t,authResult:{expiresIn:null==(n=t.token)?void 0:n.expires_in}})}),this.netlifyIdentity.on("init",function(t){var n;t&&(e.dispatch("LOGIN"),e.dispatch("AUTHENTICATED",{user:t,authResult:{expiresIn:null==(n=t.token)?void 0:n.expires_in}}))})}t.addDefaultParams=function(t,e){return void 0===t&&(t={}),t};var e=t.prototype;return e.authorize=function(){this.dispatch("LOGIN"),this.netlifyIdentity.open("login")},e.signup=function(){this.dispatch("LOGIN"),this.netlifyIdentity.open("signup")},e.logout=function(t){this.netlifyIdentity.logout()},e.handleLoginCallback=function(t){try{return console.warn("handleLoginCallback is unnecessary with Netlify Identity Widget"),Promise.resolve(!0)}catch(t){return Promise.reject(t)}},e.checkSession=function(){try{var t=this,e=function(e){var n,i=t.netlifyIdentity.currentUser();if(i)return{user:i,authResult:{expiresIn:null==(n=i.token)?void 0:n.expires_in}};throw new Error("Session invalid")},n=function(e,n){try{var i=Promise.resolve(t.netlifyIdentity.refresh()).then(function(){})}catch(t){return n()}return i&&i.then?i.then(void 0,n):i}(0,function(){throw new Error("Session invalid")});return Promise.resolve(n&&n.then?n.then(e):e())}catch(t){return Promise.reject(t)}},e.userId=function(t){return t.id},e.userRoles=function(t){return t.app_metadata.roles},t}()}); 2 | //# sourceMappingURL=NetlifyIdentity.umd.js.map 3 | -------------------------------------------------------------------------------- /dist/auth0.esm.js: -------------------------------------------------------------------------------- 1 | import{WebAuth as e}from"auth0-js";function t(){return(t=Object.assign||function(e){for(var t=1;t{this.auth0.parseHash(async function(s,r){s&&(e.dispatch("ERROR",{error:s,errorType:"authResult"}),t(!1));try{const s=await e.handleAuthResult(r);t(s)}catch(s){e.dispatch("ERROR",{error:s,errorType:"handleAuth"}),t(!1)}})})}async checkSession(){var e=this;return new Promise((t,s)=>{this.auth0.checkSession({},async function(r,a){if(!r&&a&&a.accessToken&&a.idToken)try{const s=await e.fetchUser(a);t({user:s,authResult:a})}catch(e){s(e)}else s(r||new Error("Session invalid"))})})}async handleAuthResult(e){if(e&&e.accessToken&&e.idToken){const t=await this.fetchUser(e);return this.dispatch("AUTHENTICATED",{authResult:e,user:t}),!0}return!1}async fetchUser(e){return new Promise((t,s)=>{this.auth0.client.userInfo((null==e?void 0:e.accessToken)||"",(e,r)=>{e?s(e):t(r)})})}}export{s as Auth0}; 2 | //# sourceMappingURL=auth0.modern.js.map 3 | -------------------------------------------------------------------------------- /dist/auth0.umd.js: -------------------------------------------------------------------------------- 1 | !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("auth0-js")):"function"==typeof define&&define.amd?define(["exports","auth0-js"],t):t((e||self).reactUseAuth={},e.auth0Js)}(this,function(e,t){function r(){return(r=Object.assign||function(e){for(var t=1;t; 6 | export declare const authService: import("xstate").Interpreter; 10 | -------------------------------------------------------------------------------- /dist/index.d.ts: -------------------------------------------------------------------------------- 1 | export { AuthProvider } from "./AuthProvider"; 2 | export { AuthConfig } from "./AuthConfig"; 3 | export { useAuth } from "./useAuth"; 4 | -------------------------------------------------------------------------------- /dist/providers/NetlifyIdentity.d.ts: -------------------------------------------------------------------------------- 1 | import { AuthOptions, AuthProviderClass } from "../types"; 2 | import NetlifyWidget, { User } from "netlify-identity-widget"; 3 | export declare class NetlifyIdentity implements AuthProviderClass { 4 | private netlifyIdentity; 5 | private dispatch; 6 | constructor(params: AuthOptions); 7 | static addDefaultParams(params: import("auth0-js").AuthOptions | NetlifyWidget.InitOptions | undefined, callbackDomain: string): NetlifyWidget.InitOptions; 8 | authorize(): void; 9 | signup(): void; 10 | logout(returnTo?: string): void; 11 | handleLoginCallback(dispatch: any): Promise; 12 | checkSession(): Promise<{ 13 | user: any; 14 | authResult: any; 15 | }>; 16 | userId(user: User): string; 17 | userRoles(user: User): string[] | null; 18 | } 19 | -------------------------------------------------------------------------------- /dist/providers/auth0.d.ts: -------------------------------------------------------------------------------- 1 | import { Auth0DecodedHash, Auth0UserProfile } from "auth0-js"; 2 | import { AuthOptions, AuthProviderClass, AuthUser, ProviderOptions } from "../types"; 3 | export declare class Auth0 implements AuthProviderClass { 4 | private auth0; 5 | private dispatch; 6 | private customPropertyNamespace?; 7 | constructor(params: AuthOptions); 8 | static addDefaultParams(params: ProviderOptions, callbackDomain: string): { 9 | domain: string; 10 | clientID: string; 11 | responseType: string; 12 | responseMode?: string | undefined; 13 | redirectUri: string; 14 | scope: string; 15 | audience: string; 16 | maxAge?: number | undefined; 17 | leeway?: number | undefined; 18 | jwksURI?: string | undefined; 19 | overrides?: { 20 | __tenant?: string | undefined; 21 | __token_issuer?: string | undefined; 22 | __jwks_uri?: string | undefined; 23 | } | undefined; 24 | plugins?: any; 25 | popupOrigin?: string | undefined; 26 | protocol?: string | undefined; 27 | response_type?: string | undefined; 28 | state?: string | undefined; 29 | tenant?: string | undefined; 30 | universalLoginPage?: boolean | undefined; 31 | _csrf?: string | undefined; 32 | _intstate?: string | undefined; 33 | _timesToRetryFailedRequests?: number | undefined; 34 | _disableDeprecationWarnings?: boolean | undefined; 35 | _sendTelemetry?: boolean | undefined; 36 | _telemetryInfo?: any; 37 | __tryLocalStorageFirst?: boolean | undefined; 38 | }; 39 | authorize(): void; 40 | signup(): void; 41 | logout(returnTo?: string): void; 42 | userId(user: Auth0UserProfile): string; 43 | userRoles(user: AuthUser): string[] | null; 44 | handleLoginCallback(): Promise; 45 | checkSession(): Promise<{ 46 | user: Auth0UserProfile; 47 | authResult: Auth0DecodedHash; 48 | }>; 49 | private handleAuthResult; 50 | private fetchUser; 51 | } 52 | -------------------------------------------------------------------------------- /dist/providers/index.d.ts: -------------------------------------------------------------------------------- 1 | export { Auth0 } from "./Auth0"; 2 | export { NetlifyIdentity } from "./NetlifyIdentity"; 3 | -------------------------------------------------------------------------------- /dist/react-use-auth.modern.js: -------------------------------------------------------------------------------- 1 | import t,{useEffect as e,useCallback as o,createElement as n,Fragment as r}from"react";import{useService as a}from"@xstate/react";import{addSeconds as i,isAfter as s,differenceInSeconds as u}from"date-fns";import{Machine as c,assign as l,interpret as g}from"xstate";import{choose as h}from"xstate/lib/actions";const d=({children:o,auth0_params:n={}})=>(e(()=>{console.error("The AuthProvider root component no longer works. Please take 5min to migrate to AuthConfig. 👉 https://useauth.dev/docs/upgrading")},[]),t.createElement(t.Fragment,null,o));function p(){return(p=Object.assign||function(t){for(var e=1;econsole.error("Please specify a navigation method that works with your router"),callbackDomain:"http://localhost:8000"}},states:{unauthenticated:{on:{LOGIN:"authenticating",CHECK_SESSION:"verifying",SET_CONFIG:{actions:["setConfig"]}}},authenticating:{on:{ERROR:"error",AUTHENTICATED:"authenticated",SET_CONFIG:{actions:["setConfig"]}},entry:["startAuthenticating"],exit:["stopAuthenticating"]},verifying:{invoke:{id:"checkSession",src:(t,e)=>t.config.authProvider.checkSession(),onDone:{target:"authenticated"},onError:{target:"unauthenticated",actions:["clearUserFromContext","clearLocalStorage"]}},entry:["startAuthenticating"],exit:["stopAuthenticating"]},authenticated:{on:{LOGOUT:"unauthenticated",SET_CONFIG:{actions:["setConfig"]},CHECK_SESSION:"verifying"},entry:["saveUserToContext","saveToLocalStorage"],exit:h([{cond:(t,e)=>"CHECK_SESSION"!==e.type,actions:["clearUserFromContext","clearLocalStorage"]}])},error:{entry:["saveErrorToContext","clearUserFromContext","clearLocalStorage"]}}},{actions:{startAuthenticating:l(t=>({isAuthenticating:!0})),stopAuthenticating:l(t=>({isAuthenticating:!1})),saveUserToContext:l((t,e)=>{const{authResult:o,user:n}=e.data?e.data:e;return{user:n,authResult:o,expiresAt:i(new Date,o.expiresIn)}}),clearUserFromContext:l(t=>({user:{},expiresAt:null,authResult:null})),saveToLocalStorage:(t,e)=>{const{expiresAt:o,user:n}=t;"undefined"!=typeof localStorage&&(localStorage.setItem("useAuth:expires_at",o?o.toISOString():"0"),localStorage.setItem("useAuth:user",JSON.stringify(n)))},clearLocalStorage:()=>{"undefined"!=typeof localStorage&&(localStorage.removeItem("useAuth:expires_at"),localStorage.removeItem("useAuth:user"))},saveErrorToContext:l((t,e)=>({errorType:e.errorType,error:e.error})),setConfig:l((t,e)=>({config:p({},t.config,e)}))}}));f.start(),function(t){if("undefined"!=typeof localStorage){const e=new Date(localStorage.getItem("useAuth:expires_at")||"0"),o=new Date;if(s(e,o)){const n=JSON.parse(localStorage.getItem("useAuth:user")||"{}");t("LOGIN"),t("AUTHENTICATED",{user:n,authResult:{expiresIn:u(e,o)}})}}}(f.send);const S=()=>{const[t,e]=a(f),{authProvider:n,navigate:r,callbackDomain:i}=t.context.config,u=o(async({postLoginRoute:t="/"}={})=>{n&&r?"undefined"!=typeof window&&(e("LOGIN"),await n.handleLoginCallback(e)&&r(t)):console.warn("authProvider not configured yet")},[n,r]),c=()=>!(!t.context.expiresAt||!s(t.context.expiresAt,new Date));return{isAuthenticating:t.context.isAuthenticating,isAuthenticated:c,isAuthorized:e=>{const o=Array.isArray(e)?e:[e],r=null==n?void 0:n.userRoles(t.context.user);return!(!c()||!r)&&o.some(t=>r.includes(t))},user:t.context.user,userId:null==n?void 0:n.userId(t.context.user),authResult:t.context.authResult,login:()=>{null==n||n.authorize()},signup:()=>{null==n||n.signup()},logout:t=>{"string"==typeof t?null==n||n.logout(`${i}${t}`):null==n||n.logout(),e("LOGOUT"),r("string"==typeof t?t:"/")},handleAuthentication:u,dispatch:e}},m=({authProvider:t,params:o,navigate:a,children:i})=>{const{dispatch:s}=S(),u="undefined"!=typeof window?`${window.location.protocol}//${window.location.host}`:"http://localhost:8000";return e(()=>{const e=new t(p({dispatch:s},t.addDefaultParams(o,u)));s("SET_CONFIG",{authProvider:e,navigate:a,callbackDomain:u}),s("CHECK_SESSION")},[s,t,o,a]),n(r,null,i)};export{m as AuthConfig,d as AuthProvider,S as useAuth}; 2 | //# sourceMappingURL=react-use-auth.modern.js.map 3 | -------------------------------------------------------------------------------- /dist/types.d.ts: -------------------------------------------------------------------------------- 1 | import { Auth0UserProfile, Auth0DecodedHash, Auth0Error, Auth0ParseHashError, AuthOptions as Auth0Options } from "auth0-js"; 2 | import * as NetlifyIdentityWidget from "netlify-identity-widget"; 3 | import { ReactNode } from "react"; 4 | import { AnyEventObject, PayloadSender } from "xstate"; 5 | import * as Providers from "./providers"; 6 | export declare type AuthOptions = { 7 | dispatch: (eventName: string, eventData?: any) => void; 8 | customPropertyNamespace?: string; 9 | } & ProviderOptions; 10 | export declare type ProviderOptions = Auth0Options | NetlifyIdentityWidget.InitOptions; 11 | export declare type AuthResult = ({ 12 | expiresIn: number; 13 | } & Auth0DecodedHash) | null; 14 | export declare type AuthUser = (Auth0UserProfile | NetlifyIdentityWidget.User | {}) & { 15 | [key: string]: any; 16 | }; 17 | export declare type AuthConfigInterface = (props: { 18 | authProvider: typeof Providers.Auth0 | typeof Providers.NetlifyIdentity; 19 | params?: Omit; 20 | navigate: Function; 21 | children?: ReactNode; 22 | }) => JSX.Element; 23 | export declare type AuthState = { 24 | user: AuthUser; 25 | authResult?: AuthResult; 26 | expiresAt: Date | null; 27 | isAuthenticating: boolean; 28 | errorType?: string; 29 | error?: Error | Auth0Error | Auth0ParseHashError; 30 | config: { 31 | navigate: Function; 32 | authProvider?: AuthProviderClass; 33 | callbackDomain?: string; 34 | }; 35 | }; 36 | export interface useAuthInterface { 37 | (): { 38 | isAuthenticating: boolean; 39 | isAuthenticated: () => boolean; 40 | isAuthorized: (role: string | string[]) => boolean; 41 | user: AuthUser; 42 | userId?: string | null; 43 | authResult?: AuthResult; 44 | login: () => void; 45 | signup: () => void; 46 | logout: () => void; 47 | handleAuthentication: ({ postLoginRoute }: { 48 | postLoginRoute?: string; 49 | }) => void; 50 | dispatch: (eventName: string, eventData?: any) => void; 51 | }; 52 | } 53 | export declare type AuthProviderInterface = (props: { 54 | children: ReactNode; 55 | navigate: (path: string) => void; 56 | auth0_domain: string; 57 | auth0_audience_domain?: string; 58 | auth0_client_id: string; 59 | auth0_params?: Auth0Options; 60 | customPropertyNamespace?: string; 61 | }) => JSX.Element; 62 | export interface AuthProviderClass { 63 | authorize(): void; 64 | signup(): void; 65 | logout(returnTo?: string): void; 66 | handleLoginCallback(dispatch: PayloadSender): Promise; 67 | checkSession(): Promise<{ 68 | user: Auth0UserProfile; 69 | authResult: Auth0DecodedHash; 70 | }>; 71 | userId(user: AuthUser): string | null; 72 | userRoles(user: AuthUser): string[] | null; 73 | } 74 | -------------------------------------------------------------------------------- /dist/useAuth.d.ts: -------------------------------------------------------------------------------- 1 | import { useAuthInterface } from "./types"; 2 | /** 3 | * The main API for useAuth 4 | * 5 | * @return {boolean} isAuthenticated is current user authenticated 6 | * @return {boolean} isAuthenticating currently running authentication 7 | * @return {function} isAuthorized check if current user is authenticated and matches list of roles 8 | * @return {object} user current user 9 | * @return {string} userId current user's identifier 10 | * @return {object} authResult raw authentication result object from auth provider 11 | * @return {function} login start the login process 12 | * @return {function} signup same as login, passes { mode: "signUp", screen_hint: "signup" } to Auth0 13 | * @return {function} logout start the logout process 14 | * @return {function} handleAuthentication function to call on your callback page 15 | */ 16 | export declare const useAuth: useAuthInterface; 17 | -------------------------------------------------------------------------------- /examples/gatsby-V2/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 gatsbyjs 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /examples/gatsby-V2/gatsby-browser.js: -------------------------------------------------------------------------------- 1 | /** @jsx jsx */ 2 | import { css, Global, jsx } from '@emotion/core'; 3 | import { MDXProvider } from '@mdx-js/react'; 4 | import 'focus-visible/dist/focus-visible'; 5 | import { navigate } from "gatsby"; 6 | import Highlight, { defaultProps } from 'prism-react-renderer'; 7 | import vsDark from 'prism-react-renderer/themes/vsDark'; 8 | import { AuthProvider } from "react-use-auth"; 9 | require("typeface-asap"); 10 | require("typeface-roboto"); 11 | 12 | 13 | const GlobalStyles = css` 14 | /* 15 | This will hide the focus indicator if the element receives focus via the mouse, 16 | but it will still show up on keyboard focus. 17 | */ 18 | .js-focus-visible :focus:not([data-focus-visible-added]) { 19 | outline: none; 20 | box-shadow: none; 21 | } 22 | `; 23 | 24 | // dark themes: vsDark, dracula, duotoneDark (default), nightOwl, oceanicNext 25 | /* eslint-disable */ 26 | const component = { 27 | pre: props => { 28 | const className = props.children.props.className || ''; 29 | const matches = className.match(/language-(?.*)/); 30 | return ( 31 | 41 | {({ className, style, tokens, getLineProps, getTokenProps }) => ( 42 |
43 |             {tokens.map((line, i) => (
44 |               
45 | {line.map((token, key) => ( 46 | 47 | ))} 48 |
49 | ))} 50 |
51 | )} 52 |
53 | ); 54 | }, 55 | }; 56 | 57 | 58 | export const wrapRootElement = ({ element }) => { 59 | 60 | if (typeof window !== 'undefined') { 61 | localStorage.setItem('darkMode', 'false'); 62 | } 63 | 64 | 65 | 66 | return ( 67 | 72 | 73 | 74 | {element} 75 | 76 | 77 | ) 78 | } -------------------------------------------------------------------------------- /examples/gatsby-V2/gatsby-config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | siteMetadata: { 3 | title: `useAuth`, 4 | description: `useAuth info site demo`, 5 | author: `Eric Hodges`, 6 | }, 7 | plugins: [ 8 | `gatsby-plugin-preload-fonts`, 9 | `gatsby-plugin-chakra-ui`, 10 | { 11 | resolve: `gatsby-plugin-emotion`, 12 | options: {}, 13 | }, 14 | `gatsby-plugin-react-helmet`, 15 | { 16 | resolve: `gatsby-source-filesystem`, 17 | options: { 18 | name: `images`, 19 | path: `${__dirname}/src/images`, 20 | }, 21 | }, 22 | { 23 | resolve: `gatsby-source-filesystem`, 24 | options: { 25 | name: `pages`, 26 | path: `${__dirname}/src/pages/`, 27 | }, 28 | }, 29 | `gatsby-transformer-remark`, 30 | { 31 | resolve: `gatsby-plugin-mdx`, 32 | options: { 33 | extensions: [`.mdx`, `.md`], 34 | defaultLayouts: { 35 | default: require.resolve("./src/components/docsLayout.js"), 36 | }, 37 | gatsbyRemarkPlugins: [ 38 | { 39 | resolve: `gatsby-remark-autolink-headers`, 40 | options: { 41 | enableCustomId: true, 42 | elements: [`h2`, `h3`], 43 | }, 44 | }, 45 | ], 46 | }, 47 | }, 48 | `gatsby-transformer-sharp`, 49 | `gatsby-plugin-sharp`, 50 | `gatsby-plugin-smoothscroll`, 51 | { 52 | resolve: `gatsby-plugin-manifest`, 53 | options: { 54 | name: `gatsby-starter-default`, 55 | short_name: `starter`, 56 | start_url: `/`, 57 | icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site. 58 | }, 59 | }, 60 | // this (optional) plugin enables Progressive Web App + Offline functionality 61 | // To learn more, visit: https://gatsby.dev/offline 62 | // `gatsby-plugin-offline`, 63 | ], 64 | } 65 | -------------------------------------------------------------------------------- /examples/gatsby-V2/gatsby-node.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Implement Gatsby's Node APIs in this file. 3 | * 4 | * See: https://www.gatsbyjs.org/docs/node-apis/ 5 | */ 6 | 7 | // You can delete this file if you're not using it 8 | -------------------------------------------------------------------------------- /examples/gatsby-V2/gatsby-ssr.js: -------------------------------------------------------------------------------- 1 | export { wrapRootElement } from './gatsby-browser'; 2 | -------------------------------------------------------------------------------- /examples/gatsby-V2/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "jsx": "react", 5 | "paths": { 6 | "*": ["*", "src/*"] 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /examples/gatsby-V2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gatsby-starter-default", 3 | "private": true, 4 | "description": "A simple starter to get up and developing quickly with Gatsby", 5 | "version": "0.1.0", 6 | "author": "Eric Hodges", 7 | "dependencies": { 8 | "@chakra-ui/core": "0.8.0", 9 | "@emotion/core": "^10.0.28", 10 | "@emotion/styled": "^10.0.27", 11 | "@mdx-js/mdx": "^1.5.8", 12 | "@mdx-js/react": "^1.5.8", 13 | "auth0-js": "^9.14.0", 14 | "emotion-theming": "^10.0.27", 15 | "focus-visible": "^5.1.0", 16 | "gatsby": "^2.20.12", 17 | "gatsby-image": "^2.3.1", 18 | "gatsby-plugin-chakra-ui": "^0.1.4", 19 | "gatsby-plugin-emotion": "^4.3.3", 20 | "gatsby-plugin-manifest": "^2.3.3", 21 | "gatsby-plugin-mdx": "^1.1.9", 22 | "gatsby-plugin-offline": "^3.1.2", 23 | "gatsby-plugin-preload-fonts": "^1.2.9", 24 | "gatsby-plugin-react-helmet": "^3.2.1", 25 | "gatsby-plugin-sharp": "^2.5.3", 26 | "gatsby-plugin-smoothscroll": "^1.1.0", 27 | "gatsby-remark-autolink-headers": "^2.3.1", 28 | "gatsby-source-filesystem": "^2.2.2", 29 | "gatsby-transformer-remark": "^2.8.7", 30 | "gatsby-transformer-sharp": "^2.4.3", 31 | "prism-react-renderer": "^1.1.0", 32 | "prop-types": "^15.7.2", 33 | "react": "^16.12.0", 34 | "react-dom": "^16.12.0", 35 | "react-helmet": "^5.2.1", 36 | "react-use-auth": "Swizec/useAuth.git#fix-providers", 37 | "typeface-asap": "^1.1.3", 38 | "typeface-roboto": "^0.0.75" 39 | }, 40 | "devDependencies": { 41 | "prettier": "^1.19.1" 42 | }, 43 | "keywords": [ 44 | "gatsby" 45 | ], 46 | "license": "MIT", 47 | "scripts": { 48 | "preload-fonts": "gatsby-preload-fonts", 49 | "build": "gatsby build", 50 | "start": "gatsby develop", 51 | "format": "prettier --write \"**/*.{js,jsx,json,md}\"", 52 | "serve": "gatsby serve", 53 | "clean": "gatsby clean", 54 | "test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1" 55 | }, 56 | "repository": { 57 | "type": "git", 58 | "url": "https://github.com/gatsbyjs/gatsby-starter-default" 59 | }, 60 | "bugs": { 61 | "url": "https://github.com/gatsbyjs/gatsby/issues" 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /examples/gatsby-V2/public/chunk-map.json: -------------------------------------------------------------------------------- 1 | {"app":["/app-d1c198c391345cb7546f.js"],"component---src-pages-404-js":["/component---src-pages-404-js-670d78c077072ad10c98.js"],"component---src-pages-auth-0-callback-js":["/component---src-pages-auth-0-callback-js-43c5d91e91b0ce57c4a5.js"],"component---src-pages-docs-auth-mdx":["/component---src-pages-docs-auth-mdx-8a523fea82b58e688a94.js"],"component---src-pages-docs-callback-mdx":["/component---src-pages-docs-callback-mdx-12c8e7ed8599ad0f8a79.js"],"component---src-pages-docs-enjoy-mdx":["/component---src-pages-docs-enjoy-mdx-5d76df1dde88425fc86e.js"],"component---src-pages-docs-getting-started-mdx":["/component---src-pages-docs-getting-started-mdx-9d1444ad087d61d15115.js"],"component---src-pages-index-js":["/component---src-pages-index-js-4a86f52f350c1cc5ec08.js"]} -------------------------------------------------------------------------------- /examples/gatsby-V2/public/component---src-pages-404-js-670d78c077072ad10c98.js: -------------------------------------------------------------------------------- 1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[4],{w2l6:function(e,t,n){"use strict";n.r(t);var a=n("q1tI"),l=n.n(a),u=n("Bl7J"),o=n("vrFN");t.default=function(){return l.a.createElement(u.a,null,l.a.createElement(o.a,{title:"404: Not found"}),l.a.createElement("h1",null,"NOT FOUND"),l.a.createElement("p",null,"You just hit a route that doesn't exist... the sadness."))}}}]); 2 | //# sourceMappingURL=component---src-pages-404-js-670d78c077072ad10c98.js.map -------------------------------------------------------------------------------- /examples/gatsby-V2/public/component---src-pages-404-js-670d78c077072ad10c98.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["webpack:///./src/pages/404.js"],"names":["NotFoundPage","title"],"mappings":"2FAAA,wDAaeA,UARM,kBACnB,kBAAC,IAAD,KACE,kBAAC,IAAD,CAAKC,MAAM,mBACX,yCACA","file":"component---src-pages-404-js-670d78c077072ad10c98.js","sourcesContent":["import React from \"react\"\n\nimport Layout from \"../components/layout\"\nimport SEO from \"../components/seo\"\n\nconst NotFoundPage = () => (\n \n \n

NOT FOUND

\n

You just hit a route that doesn't exist... the sadness.

\n
\n)\n\nexport default NotFoundPage\n"],"sourceRoot":""} -------------------------------------------------------------------------------- /examples/gatsby-V2/public/component---src-pages-auth-0-callback-js-43c5d91e91b0ce57c4a5.js: -------------------------------------------------------------------------------- 1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[5],{FAeX:function(e,t,n){"use strict";n.r(t);var a=n("BMxC"),c=n("qWyU"),s=n("q1tI"),i=n.n(s),l=n("+NMY"),r=n("Bl7J"),u=n("vrFN");t.default=function(){var e=Object(l.b)().handleAuthentication;return Object(s.useEffect)((function(){e()})),i.a.createElement(r.a,null,i.a.createElement(u.a,{title:"Success"}),i.a.createElement(a.a,{h:"94vh",w:"100vw",display:"flex",alignItems:"center",justifyContent:"center"},i.a.createElement(c.a,{as:"h2"},"Login Success")))}}}]); 2 | //# sourceMappingURL=component---src-pages-auth-0-callback-js-43c5d91e91b0ce57c4a5.js.map -------------------------------------------------------------------------------- /examples/gatsby-V2/public/component---src-pages-auth-0-callback-js-43c5d91e91b0ce57c4a5.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["webpack:///./src/pages/auth0_callback.js"],"names":["Auth0CallbackPage","handleAuthentication","useAuth","useEffect","title","h","w","display","alignItems","justifyContent","as"],"mappings":"2FAAA,4FAuBeA,UAjBW,WAAO,IACvBC,EAAyBC,cAAzBD,qBAOV,OANEE,qBAAU,WACRF,OAMF,kBAAC,IAAD,KACE,kBAAC,IAAD,CAAKG,MAAM,YACX,kBAAC,IAAD,CAAMC,EAAE,OAAOC,EAAE,QAAQC,QAAQ,OAAOC,WAAW,SAASC,eAAe,UACzE,kBAAC,IAAD,CAASC,GAAG,MAAZ","file":"component---src-pages-auth-0-callback-js-43c5d91e91b0ce57c4a5.js","sourcesContent":["import { Box, Heading } from \"@chakra-ui/core\";\nimport React, { useEffect } from \"react\";\nimport { useAuth } from \"react-use-auth\";\nimport Layout from \"../components/layout\";\nimport SEO from \"../components/seo\";\n\nconst Auth0CallbackPage = () => {\n const { handleAuthentication } = useAuth();\n useEffect(() => {\n handleAuthentication()\n });\n \n // const { colorMode } = useColorMode();\n\nreturn (\n \n \n \n Login Success \n \n \n)\n}\nexport default Auth0CallbackPage;\n"],"sourceRoot":""} -------------------------------------------------------------------------------- /examples/gatsby-V2/public/component---src-pages-index-js-4a86f52f350c1cc5ec08.js: -------------------------------------------------------------------------------- 1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[10],{RXBc:function(e,t,a){"use strict";a.r(t);var l=a("mf32"),n=a("BMxC"),r=a("OQ2h"),c=a("qWyU"),i=a("q1tI"),o=a.n(i),s=a("Bl7J"),u=a("vrFN");t.default=function(e){var t=Object(l.b)().colorMode;return o.a.createElement(s.a,null,o.a.createElement(u.a,{title:"Home"}),o.a.createElement(n.a,{bg:"light"===t?"grey.600":"grey.800",h:"94vh",w:"100vw",display:"flex",flexDir:"column",alignItems:"center",justifyContent:"center",color:"light"===t?"black":"#ccc"},o.a.createElement(n.a,null,o.a.createElement(n.a,{display:"flex",alignItems:"center"},o.a.createElement(r.a,{"aria-label":"Switch to "+("light"===t?"dark":"light")+" mode",isRound:"true",variant:"ghost",color:"current",padding:"0",ml:"-.3rem",fontSize:"36px",icon:"lock"}),o.a.createElement(c.a,{as:"h1",size:"2xl",color:"pri",style:{letterSpacing:"-3px"}},"useAuth")),o.a.createElement(c.a,{as:"h2",size:"lg",mb:2},"Authentication for React Apps"),o.a.createElement("code",null,"yarn add react-use-auth"))))}}}]); 2 | //# sourceMappingURL=component---src-pages-index-js-4a86f52f350c1cc5ec08.js.map -------------------------------------------------------------------------------- /examples/gatsby-V2/public/component---src-pages-index-js-4a86f52f350c1cc5ec08.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["webpack:///./src/pages/index.js"],"names":["IndexPage","props","colorMode","useColorMode","title","bg","h","w","display","flexDir","alignItems","justifyContent","color","aria-label","isRound","variant","padding","ml","fontSize","icon","as","size","style","letterSpacing","mb"],"mappings":"4FAAA,wGAqCeA,UAhCG,SAACC,GAAW,IAEpBC,EAAcC,cAAdD,UAEV,OACE,kBAAC,IAAD,KACE,kBAAC,IAAD,CAAKE,MAAM,SACX,kBAAC,IAAD,CAAKC,GAAkB,UAAdH,EAAuB,WAAa,WAAYI,EAAE,OAAOC,EAAE,QAAQC,QAAQ,OAAOC,QAAQ,SAASC,WAAW,SAASC,eAAe,SAASC,MAAqB,UAAdV,EAAuB,QAAU,QAC9L,kBAAC,IAAD,KACE,kBAAC,IAAD,CAAKM,QAAQ,OAAOE,WAAW,UAC/B,kBAAC,IAAD,CACEG,aAAA,cACgB,UAAdX,EAAwB,OAAS,SADnC,QAGAY,QAAQ,OACRC,QAAQ,QACRH,MAAM,UACNI,QAAQ,IACRC,GAAG,SACHC,SAAS,OACTC,KAAK,SAEP,kBAAC,IAAD,CAASC,GAAG,KAAKC,KAAK,MAAMT,MAAM,MAAMU,MAAO,CAACC,cAAe,SAA/D,YAEA,kBAAC,IAAD,CAASH,GAAG,KAAKC,KAAK,KAAKG,GAAI,GAA/B,iCACA","file":"component---src-pages-index-js-4a86f52f350c1cc5ec08.js","sourcesContent":["import { Box, Heading, IconButton, useColorMode } from \"@chakra-ui/core\"\nimport React from \"react\"\nimport Layout from \"../components/layout\"\nimport SEO from \"../components/seo\"\n\nconst IndexPage = (props) => {\n\n const { colorMode } = useColorMode();\n\nreturn (\n \n \n \n \n \n \n useAuth\n \n Authentication for React Apps\n yarn add react-use-auth\n \n \n\n \n)\n}\nexport default IndexPage\n"],"sourceRoot":""} -------------------------------------------------------------------------------- /examples/gatsby-V2/public/icons/icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swizec/useAuth/9aa10b832896fb9932587b1ab5b57c6e821888d5/examples/gatsby-V2/public/icons/icon-144x144.png -------------------------------------------------------------------------------- /examples/gatsby-V2/public/icons/icon-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swizec/useAuth/9aa10b832896fb9932587b1ab5b57c6e821888d5/examples/gatsby-V2/public/icons/icon-192x192.png -------------------------------------------------------------------------------- /examples/gatsby-V2/public/icons/icon-256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swizec/useAuth/9aa10b832896fb9932587b1ab5b57c6e821888d5/examples/gatsby-V2/public/icons/icon-256x256.png -------------------------------------------------------------------------------- /examples/gatsby-V2/public/icons/icon-384x384.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swizec/useAuth/9aa10b832896fb9932587b1ab5b57c6e821888d5/examples/gatsby-V2/public/icons/icon-384x384.png -------------------------------------------------------------------------------- /examples/gatsby-V2/public/icons/icon-48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swizec/useAuth/9aa10b832896fb9932587b1ab5b57c6e821888d5/examples/gatsby-V2/public/icons/icon-48x48.png -------------------------------------------------------------------------------- /examples/gatsby-V2/public/icons/icon-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swizec/useAuth/9aa10b832896fb9932587b1ab5b57c6e821888d5/examples/gatsby-V2/public/icons/icon-512x512.png -------------------------------------------------------------------------------- /examples/gatsby-V2/public/icons/icon-72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swizec/useAuth/9aa10b832896fb9932587b1ab5b57c6e821888d5/examples/gatsby-V2/public/icons/icon-72x72.png -------------------------------------------------------------------------------- /examples/gatsby-V2/public/icons/icon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swizec/useAuth/9aa10b832896fb9932587b1ab5b57c6e821888d5/examples/gatsby-V2/public/icons/icon-96x96.png -------------------------------------------------------------------------------- /examples/gatsby-V2/public/index.html: -------------------------------------------------------------------------------- 1 |
-------------------------------------------------------------------------------- /examples/gatsby-V2/public/manifest.webmanifest: -------------------------------------------------------------------------------- 1 | {"name":"gatsby-starter-default","short_name":"starter","start_url":"/","icons":[{"src":"icons/icon-48x48.png?v=edf3d310d67f8284a562bc3a58c3e761","sizes":"48x48","type":"image/png"},{"src":"icons/icon-72x72.png?v=edf3d310d67f8284a562bc3a58c3e761","sizes":"72x72","type":"image/png"},{"src":"icons/icon-96x96.png?v=edf3d310d67f8284a562bc3a58c3e761","sizes":"96x96","type":"image/png"},{"src":"icons/icon-144x144.png?v=edf3d310d67f8284a562bc3a58c3e761","sizes":"144x144","type":"image/png"},{"src":"icons/icon-192x192.png?v=edf3d310d67f8284a562bc3a58c3e761","sizes":"192x192","type":"image/png"},{"src":"icons/icon-256x256.png?v=edf3d310d67f8284a562bc3a58c3e761","sizes":"256x256","type":"image/png"},{"src":"icons/icon-384x384.png?v=edf3d310d67f8284a562bc3a58c3e761","sizes":"384x384","type":"image/png"},{"src":"icons/icon-512x512.png?v=edf3d310d67f8284a562bc3a58c3e761","sizes":"512x512","type":"image/png"}]} -------------------------------------------------------------------------------- /examples/gatsby-V2/public/page-data/404.html/page-data.json: -------------------------------------------------------------------------------- 1 | {"componentChunkName":"component---src-pages-404-js","path":"/404.html","result":{"pageContext":{}}} -------------------------------------------------------------------------------- /examples/gatsby-V2/public/page-data/404/page-data.json: -------------------------------------------------------------------------------- 1 | {"componentChunkName":"component---src-pages-404-js","path":"/404/","result":{"pageContext":{}}} -------------------------------------------------------------------------------- /examples/gatsby-V2/public/page-data/app-data.json: -------------------------------------------------------------------------------- 1 | {"webpackCompilationHash":"8970aadb386d1148fd41"} 2 | -------------------------------------------------------------------------------- /examples/gatsby-V2/public/page-data/auth0_callback/page-data.json: -------------------------------------------------------------------------------- 1 | {"componentChunkName":"component---src-pages-auth-0-callback-js","path":"/auth0_callback/","result":{"pageContext":{}}} -------------------------------------------------------------------------------- /examples/gatsby-V2/public/page-data/callback/page-data.json: -------------------------------------------------------------------------------- 1 | {"componentChunkName":"component---src-pages-callback-js","path":"/callback/","result":{"pageContext":{}}} -------------------------------------------------------------------------------- /examples/gatsby-V2/public/page-data/dev-404-page/page-data.json: -------------------------------------------------------------------------------- 1 | {"componentChunkName":"component---cache-dev-404-page-js","path":"/dev-404-page/","result":{"data":{"allSitePage":{"nodes":[{"path":"/404/"},{"path":"/auth0_callback/"},{"path":"/"},{"path":"/404.html"},{"path":"/docs/auth/"},{"path":"/docs/callback/"},{"path":"/docs/enjoy/"},{"path":"/docs/getting-started/"}]}},"pageContext":{}}} -------------------------------------------------------------------------------- /examples/gatsby-V2/public/page-data/docs/auth/page-data.json: -------------------------------------------------------------------------------- 1 | {"componentChunkName":"component---src-pages-docs-auth-mdx","path":"/docs/auth/","result":{"pageContext":{"frontmatter":{}}}} -------------------------------------------------------------------------------- /examples/gatsby-V2/public/page-data/docs/callback/page-data.json: -------------------------------------------------------------------------------- 1 | {"componentChunkName":"component---src-pages-docs-callback-mdx","path":"/docs/callback/","result":{"pageContext":{"frontmatter":{}}}} -------------------------------------------------------------------------------- /examples/gatsby-V2/public/page-data/docs/enjoy/page-data.json: -------------------------------------------------------------------------------- 1 | {"componentChunkName":"component---src-pages-docs-enjoy-mdx","path":"/docs/enjoy/","result":{"pageContext":{"frontmatter":{}}}} -------------------------------------------------------------------------------- /examples/gatsby-V2/public/page-data/docs/getting-started/page-data.json: -------------------------------------------------------------------------------- 1 | {"componentChunkName":"component---src-pages-docs-getting-started-mdx","path":"/docs/getting-started/","result":{"pageContext":{"frontmatter":{}}}} -------------------------------------------------------------------------------- /examples/gatsby-V2/public/page-data/docs/test/page-data.json: -------------------------------------------------------------------------------- 1 | {"componentChunkName":"component---src-pages-docs-test-mdx","path":"/docs/test/","result":{"pageContext":{"frontmatter":{}}}} -------------------------------------------------------------------------------- /examples/gatsby-V2/public/page-data/index/page-data.json: -------------------------------------------------------------------------------- 1 | {"componentChunkName":"component---src-pages-index-js","path":"/","result":{"pageContext":{}}} -------------------------------------------------------------------------------- /examples/gatsby-V2/public/static/6d91c86c0fde632ba4cd01062fd9ccfa/2a4de/gatsby-astronaut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swizec/useAuth/9aa10b832896fb9932587b1ab5b57c6e821888d5/examples/gatsby-V2/public/static/6d91c86c0fde632ba4cd01062fd9ccfa/2a4de/gatsby-astronaut.png -------------------------------------------------------------------------------- /examples/gatsby-V2/public/static/6d91c86c0fde632ba4cd01062fd9ccfa/5db04/gatsby-astronaut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swizec/useAuth/9aa10b832896fb9932587b1ab5b57c6e821888d5/examples/gatsby-V2/public/static/6d91c86c0fde632ba4cd01062fd9ccfa/5db04/gatsby-astronaut.png -------------------------------------------------------------------------------- /examples/gatsby-V2/public/static/6d91c86c0fde632ba4cd01062fd9ccfa/62b1f/gatsby-astronaut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swizec/useAuth/9aa10b832896fb9932587b1ab5b57c6e821888d5/examples/gatsby-V2/public/static/6d91c86c0fde632ba4cd01062fd9ccfa/62b1f/gatsby-astronaut.png -------------------------------------------------------------------------------- /examples/gatsby-V2/public/static/6d91c86c0fde632ba4cd01062fd9ccfa/630fb/gatsby-astronaut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swizec/useAuth/9aa10b832896fb9932587b1ab5b57c6e821888d5/examples/gatsby-V2/public/static/6d91c86c0fde632ba4cd01062fd9ccfa/630fb/gatsby-astronaut.png -------------------------------------------------------------------------------- /examples/gatsby-V2/public/static/6d91c86c0fde632ba4cd01062fd9ccfa/6d161/gatsby-astronaut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swizec/useAuth/9aa10b832896fb9932587b1ab5b57c6e821888d5/examples/gatsby-V2/public/static/6d91c86c0fde632ba4cd01062fd9ccfa/6d161/gatsby-astronaut.png -------------------------------------------------------------------------------- /examples/gatsby-V2/public/static/6d91c86c0fde632ba4cd01062fd9ccfa/ee604/gatsby-astronaut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swizec/useAuth/9aa10b832896fb9932587b1ab5b57c6e821888d5/examples/gatsby-V2/public/static/6d91c86c0fde632ba4cd01062fd9ccfa/ee604/gatsby-astronaut.png -------------------------------------------------------------------------------- /examples/gatsby-V2/public/static/d/2417117884.json: -------------------------------------------------------------------------------- 1 | {"data":{"site":{"siteMetadata":{"title":"useAuth","description":"useAuth info site demo","author":"Eric Hodges"}}}} -------------------------------------------------------------------------------- /examples/gatsby-V2/public/static/d/2969191536.json: -------------------------------------------------------------------------------- 1 | {"data":{"placeholderImage":{"childImageSharp":{"fluid":{"base64":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAACXBIWXMAAAsSAAALEgHS3X78AAACYklEQVQ4y42Uy28SQRjA+dM8efDmwYN6qF6qiSY+Y/WgQRMibY00TaWNBSRSCraYQtHl/bR0KyxQWCgWWAqU8izl/Sq7rLNsRHlVJpvJtzPfb77nDIOcZHSoqZSrp4+KtXIziubaLRysMCZiCYqOoVnhjNEi8RcztdxxeTzc6VBfT+5O2Vhpb+vw4wMdZ0ppWvP9xzLeJoDNThf2W+Nz1+XzNxQubSToSKKW+BDc+WOnkshhSVgeCiGpViZMEg1oxc26Knt+ae3bEtJTZwzE1kXLccG0+sOOlrcvZXvsczPkITfsa20vwIKnhsh+BnjUarT74Gb13CY7KBVJMv3z4N1NszQYsMWM62HNrCis/GxXn0iYls23uz5LPBcv0bH8hUH2XRoM85ySXv7JBtO87jMIvWq+H5GoYIHCLA1ZxD6Qap3Ak8IKfW7TJ50lK6uP9E6RgndHaODtCJ6Z5RyHfnE7j6gRbcKlCYNSt+rtETHTpUGgEP8FYmdNqd/Mo7aiVWTfuH2L9xASvfxxlqr01EYkrJszvNkgW9bH0OuFr+99m+y9IOeyU6zIp/Hubp/yMEztlzFPwOhdvq+nIoS1JNn4t2sugCmVsDvPe2KKolnZLCxhOcAKQRDDXTQaVi46lqYhIBwHTrl3oWqhMRDtaJge37lOBMKo4tfbqhVX0J7snTsWps8uZWuoOQY6CcjpSIF55UvmqNgr5wUwtV1IVdnXtnSfPEB2qjDNqnvczRl0m+j6Jn5lXb6nAQJqinmN0ZEBj03YLzghY8PnTRz80o/GRJZpOLCb0PM9BN7pvUEjx28V00WUg9jIVwAAAABJRU5ErkJggg==","aspectRatio":1,"src":"/static/6d91c86c0fde632ba4cd01062fd9ccfa/630fb/gatsby-astronaut.png","srcSet":"/static/6d91c86c0fde632ba4cd01062fd9ccfa/5db04/gatsby-astronaut.png 75w,\n/static/6d91c86c0fde632ba4cd01062fd9ccfa/6d161/gatsby-astronaut.png 150w,\n/static/6d91c86c0fde632ba4cd01062fd9ccfa/630fb/gatsby-astronaut.png 300w,\n/static/6d91c86c0fde632ba4cd01062fd9ccfa/62b1f/gatsby-astronaut.png 450w,\n/static/6d91c86c0fde632ba4cd01062fd9ccfa/2a4de/gatsby-astronaut.png 600w,\n/static/6d91c86c0fde632ba4cd01062fd9ccfa/ee604/gatsby-astronaut.png 800w","sizes":"(max-width: 300px) 100vw, 300px"}}}}} -------------------------------------------------------------------------------- /examples/gatsby-V2/public/static/d/856328897.json: -------------------------------------------------------------------------------- 1 | {"data":{"site":{"siteMetadata":{"title":"useAuth"}}}} -------------------------------------------------------------------------------- /examples/gatsby-V2/public/webpack-runtime-37f1cbc6cebaadfe94d8.js: -------------------------------------------------------------------------------- 1 | !function(e){function r(r){for(var n,a,u=r[0],d=r[1],f=r[2],i=0,p=[];i { 10 | const data = useStaticQuery(graphql` 11 | query SiteTitleQuery { 12 | site { 13 | siteMetadata { 14 | title 15 | } 16 | } 17 | } 18 | `) 19 | 20 | const colorMode = useColorMode(); 21 | 22 | return ( 23 | 24 | 25 | 26 |
27 |
28 |
{children}
29 |
30 |
31 |
32 | 33 | 34 | ) 35 | } 36 | 37 | Layout.propTypes = { 38 | children: PropTypes.node.isRequired, 39 | } 40 | 41 | export default Layout 42 | -------------------------------------------------------------------------------- /examples/gatsby-V2/src/components/seo.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SEO component that queries for data with 3 | * Gatsby's useStaticQuery React hook 4 | * 5 | * See: https://www.gatsbyjs.org/docs/use-static-query/ 6 | */ 7 | 8 | import React from "react" 9 | import PropTypes from "prop-types" 10 | import Helmet from "react-helmet" 11 | import { useStaticQuery, graphql } from "gatsby" 12 | 13 | function SEO({ description, lang, meta, title }) { 14 | const { site } = useStaticQuery( 15 | graphql` 16 | query { 17 | site { 18 | siteMetadata { 19 | title 20 | description 21 | author 22 | } 23 | } 24 | } 25 | ` 26 | ) 27 | 28 | const metaDescription = description || site.siteMetadata.description 29 | 30 | return ( 31 | 72 | ) 73 | } 74 | 75 | SEO.defaultProps = { 76 | lang: `en`, 77 | meta: [], 78 | description: ``, 79 | } 80 | 81 | SEO.propTypes = { 82 | description: PropTypes.string, 83 | lang: PropTypes.string, 84 | meta: PropTypes.arrayOf(PropTypes.object), 85 | title: PropTypes.string.isRequired, 86 | } 87 | 88 | export default SEO 89 | -------------------------------------------------------------------------------- /examples/gatsby-V2/src/images/gatsby-astronaut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swizec/useAuth/9aa10b832896fb9932587b1ab5b57c6e821888d5/examples/gatsby-V2/src/images/gatsby-astronaut.png -------------------------------------------------------------------------------- /examples/gatsby-V2/src/images/gatsby-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swizec/useAuth/9aa10b832896fb9932587b1ab5b57c6e821888d5/examples/gatsby-V2/src/images/gatsby-icon.png -------------------------------------------------------------------------------- /examples/gatsby-V2/src/pages/404.js: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | 3 | import Layout from "../components/layout" 4 | import SEO from "../components/seo" 5 | 6 | const NotFoundPage = () => ( 7 | 8 | 9 |

NOT FOUND

10 |

You just hit a route that doesn't exist... the sadness.

11 |
12 | ) 13 | 14 | export default NotFoundPage 15 | -------------------------------------------------------------------------------- /examples/gatsby-V2/src/pages/auth0_callback.js: -------------------------------------------------------------------------------- 1 | import { Box, Heading } from "@chakra-ui/core"; 2 | import React, { useEffect } from "react"; 3 | import { useAuth } from "react-use-auth"; 4 | import Layout from "../components/layout"; 5 | import SEO from "../components/seo"; 6 | 7 | const Auth0CallbackPage = () => { 8 | const { handleAuthentication } = useAuth(); 9 | useEffect(() => { 10 | handleAuthentication() 11 | }); 12 | 13 | // const { colorMode } = useColorMode(); 14 | 15 | return ( 16 | 17 | 18 | 19 | Login Success 20 | 21 | 22 | ) 23 | } 24 | export default Auth0CallbackPage; 25 | -------------------------------------------------------------------------------- /examples/gatsby-V2/src/pages/docs/auth.mdx: -------------------------------------------------------------------------------- 1 | ## 2. Set up AuthProvider 2 | 3 | 4 | useAuth uses an AuthProvider component to configure the Auth0 client and share state between components. It's using React context with a reducer behind the scenes, but that's an implementation detail. 5 | 6 | I recommend adding this around your root component. In Gatsby that's done in gatsby-browser.js and gatsby-ssr.js. Yes useAuth is built so it doesn't break server-side rendering. ✌️ 7 | 8 | But of course server-side "you" will always be logged out. 9 | 10 | ```jsx 11 | import React from "react" 12 | import { navigate } from "gatsby" 13 | 14 | import { AuthProvider } from "react-use-auth" 15 | 16 | export const wrapRootElement = ({ element }) => ( 17 | 22 | {element} 23 | 24 | ) 25 | ``` 26 | 27 | `````` creates a context, sets up a state reducer, initializes an Auth0 client and so on. Everything you need for authentication to work in your whole app :) 28 | 29 | The API takes a couple config options: 30 | 31 | ```navigate``` – your navigation function, used for redirects. I've tested with Gatsby, but anything should work 32 | 33 | ```auth0_domain``` – from your Auth0 app 34 | 35 | ```auth0_client_id``` – from your Auth0 app 36 | 37 | ```auth0_params``` – an object that lets you overwrite any of the default Auth0 client parameters 38 | 39 | PS: even though Auth doesn't do anything server-side, useAuth will throw errors during build, if its context doesn't exist 40 | 41 | ### Default Auth0 params 42 | 43 | By default ```useAuth```'s Auth0 client uses these params: 44 | 45 | ```jsx 46 | const params = { 47 | domain: auth0_domain, 48 | clientID: auth0_client_id, 49 | redirectUri: `${callback_domain}/auth0_callback`, 50 | audience: `https://${auth0_domain}/api/v2/`, 51 | responseType: "token id_token", 52 | scope: "openid profile email" 53 | } 54 | ``` 55 | 56 | ```domain``` and ```clientID``` come from your props. 57 | 58 | ```redirectUri``` is set to use the ```auth0_callbackpage``` on the current domain. Auth0 redirects here after users login so you can set cookies and stuff. useAuthwill handle this for you ✌️ 59 | 60 | ```audience``` is set to use api/v2. I know this is necessary but honestly have been copypasting it through several of my projects. 61 | 62 | ```responseType``` same here. I copy paste this from old projects so I figured it's a good default. 63 | 64 | ```scope``` you need openid for social logins and to be able to fetch user profiles after authentication. Profile and Email too. You can add more via the ```auth0_params``` override. -------------------------------------------------------------------------------- /examples/gatsby-V2/src/pages/docs/callback.mdx: -------------------------------------------------------------------------------- 1 | ## 3. Create the callback page 2 | 3 | 4 | Auth0 and most other authentication providers use OAuth. That requires redirecting your user to their login form. After login, the provider redirects the user back to your app. 5 | 6 | Any way of creating React pages should work, here's what I use for Gatsby: 7 | 8 | ```jsx 9 | import React, { useEffect } from "react" 10 | import { useAuth } from "react-use-auth" 11 | import Layout from "../components/layout" 12 | 13 | const Auth0CallbackPage = () = { 14 | const { handleAuthentication } = useAuth() 15 | useEffect(() => { 16 | handleAuthentication() 17 | }, []) 18 | 19 | return ( 20 | 21 |

22 | This is the auth callback page, 23 | you should be redirected immediately! 24 |

25 |
26 | ) 27 | } 28 | 29 | export default Auth0CallbackPage 30 | ``` 31 | 32 | The goal is to load a page, briefly show some text, and run the ```handleAuthentication``` method from useAuthon page load. 33 | 34 | That method will create a cookie in local storage with your user's information and redirect back to homepage. Redirecting to other post-login pages currently isn't supported but is a good idea now that I thought of it 🤔 35 | 36 | PS: Make sure you add ```domain/auth0_callback``` as a valid callback URL in your Auth0 config -------------------------------------------------------------------------------- /examples/gatsby-V2/src/pages/docs/enjoy.mdx: -------------------------------------------------------------------------------- 1 | ## 4. Enjoy useAuth 2 | 3 | 4 | You're ready to use useAuth for authentication in your React app. 5 | 6 | Here's a login button for example: 7 | 8 | ```jsx 9 | const Login = () => { 10 | const { isAuthenticated, login, logout } = useAuth() 11 | 12 | if (isAuthenticated()) { 13 | return 14 | } else { 15 | return 16 | } 17 | } 18 | ``` 19 | 20 | ```isAuthenticated``` is a method that checks if the user's cookie is still valid. 21 | 22 | ```login``` and ```logout``` trigger their respective actions. 23 | 24 | You can even say hello to your users: 25 | 26 | ```jsx 27 | // src/pages/index.js 28 | 29 | const IndexPage = () => { 30 | const { isAuthenticated, user } = useAuth() 31 | 32 | return ( 33 | 34 | 35 |

Hi {isAuthenticated() ? user.name : "people"}

36 | ) 37 | } 38 | ``` 39 | 40 | Check ```isAuthenticated``` then use the user object. Simple as that. -------------------------------------------------------------------------------- /examples/gatsby-V2/src/pages/docs/getting-started.mdx: -------------------------------------------------------------------------------- 1 | 2 | # Getting Started 3 | 4 | useAuth is designed to be quick to setup. You'll need an Auth0 account with an app domain and client id. 5 | 6 | 7 | ## 1. Install the hook 8 | 9 | ``` 10 | $ yarn add react-use-auth 11 | ``` 12 | 13 | Downloads from npm, adds to your package.json, etc. You can use npm as well. 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/gatsby-V2/src/pages/index.js: -------------------------------------------------------------------------------- 1 | import { Box, Button, Heading, IconButton, useColorMode } from "@chakra-ui/core"; 2 | import { css } from '@emotion/core'; 3 | import { Link } from "gatsby"; 4 | import React from "react"; 5 | import Layout from "../components/layout"; 6 | import SEO from "../components/seo"; 7 | 8 | const IndexPage = (props) => { 9 | 10 | 11 | const { colorMode } = useColorMode(); 12 | 13 | const codeStyleLight = { 14 | fontFamily: "Menlo, monospace", 15 | color: "#416B9C" 16 | } 17 | 18 | const codeStyleDark = { 19 | fontFamily: "Menlo, monospace", 20 | color: "#9DDDFF" 21 | } 22 | 23 | const logoStyle = css` 24 | letter-spacing: -4px; 25 | font: 600 3.2rem Asap; 26 | ` 27 | 28 | const h2Style = { 29 | font: '600 1.5rem Roboto' 30 | } 31 | 32 | const buttonStyle = { 33 | font: '600 1.2rem Roboto' 34 | } 35 | 36 | return ( 37 | 38 | 39 | 40 | 41 | 42 | 52 | useAuth 53 | 54 | 56 | React App Authentication 57 | 58 | yarn add react-use-auth 59 |
60 | npm i react-use-auth 61 |
62 | 63 | 64 | 65 |
66 |
67 | 68 | 69 |
70 | ) 71 | } 72 | export default IndexPage 73 | -------------------------------------------------------------------------------- /examples/gatsby-V2/src/styled/headerStyles.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swizec/useAuth/9aa10b832896fb9932587b1ab5b57c6e821888d5/examples/gatsby-V2/src/styled/headerStyles.js -------------------------------------------------------------------------------- /examples/useAuth.dev/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | public 3 | .cache -------------------------------------------------------------------------------- /examples/useAuth.dev/LICENSE.MD: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Eric Hodges 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /examples/useAuth.dev/README.md: -------------------------------------------------------------------------------- 1 | # useAuth Docs 2 | -------------------------------------------------------------------------------- /examples/useAuth.dev/gatsby-browser.js: -------------------------------------------------------------------------------- 1 | export { wrapPageElement } from './src'; 2 | -------------------------------------------------------------------------------- /examples/useAuth.dev/gatsby-config.js: -------------------------------------------------------------------------------- 1 | const remarkPlugins = [require("remark-slug")]; 2 | 3 | module.exports = { 4 | plugins: [ 5 | "gatsby-plugin-preload-fonts", 6 | "gatsby-plugin-theme-ui", 7 | "gatsby-plugin-react-helmet", 8 | "gatsby-plugin-catch-links", 9 | { 10 | resolve: "gatsby-source-filesystem", 11 | options: { 12 | name: "docsImages", 13 | path: `${__dirname}/src/pages/docs/images` 14 | } 15 | }, 16 | "gatsby-plugin-sharp", 17 | { 18 | resolve: "gatsby-plugin-mdx", 19 | options: { 20 | extensions: [".mdx", ".md"], 21 | remarkPlugins, 22 | gatsbyRemarkPlugins: [ 23 | "gatsby-remark-copy-linked-files", 24 | { 25 | resolve: "gatsby-remark-images", 26 | options: { 27 | markdownCaptions: false, 28 | maxWidth: 890, 29 | linkImagestoOriginal: false, 30 | showCaptions: ["title", "alt"], 31 | withWebp: true, 32 | wrapperStyle: 33 | "text-align: center; font-style: italic", 34 | tracedSVG: { 35 | color: `lightgray`, 36 | optTolerance: 0.4, 37 | turdSize: 100, 38 | turnPolicy: "TURNPOLICY_MAJORITY" 39 | }, 40 | loading: "lazy" 41 | } 42 | } 43 | ] 44 | } 45 | }, 46 | "gatsby-plugin-simple-analytics" 47 | ] 48 | }; 49 | -------------------------------------------------------------------------------- /examples/useAuth.dev/gatsby-node.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swizec/useAuth/9aa10b832896fb9932587b1ab5b57c6e821888d5/examples/useAuth.dev/gatsby-node.js -------------------------------------------------------------------------------- /examples/useAuth.dev/gatsby-ssr.js: -------------------------------------------------------------------------------- 1 | export { wrapPageElement } from './src'; 2 | -------------------------------------------------------------------------------- /examples/useAuth.dev/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "use-auth-docs", 4 | "version": "0.0.1", 5 | "main": "index.js", 6 | "author": "Eric Hodges", 7 | "license": "MIT", 8 | "description": "useAuth docs", 9 | "scripts": { 10 | "start": "gatsby develop", 11 | "build": "gatsby build", 12 | "serve": "gatsby serve", 13 | "clean": "gatsby clean", 14 | "logo": "node ./scripts/svg-logo.js", 15 | "logo:png": "npx repng src/components/logo.js -d static -f logo.png -w=256 -h=256", 16 | "card": "npx repng src/components/og-image.js -d static -f card.png -w=1280 -h=720", 17 | "icon": "npx repng src/components/logo.js -d static -f icon.png -w=32 -h=32 --props='{\"size\":32}'" 18 | }, 19 | "dependencies": { 20 | "@emotion/core": "^10.0.10", 21 | "@emotion/styled": "^10.0.10", 22 | "@mdx-js/mdx": "^1.0.0-rc.0", 23 | "@mdx-js/react": "^1.0.0-rc.0", 24 | "@theme-ui/prism": "^0.4.0-rc.1", 25 | "@theme-ui/sidenav": "^0.4.0-rc.1", 26 | "auth0-js": "^9.14.0", 27 | "gatsby": "^2.23.12", 28 | "gatsby-plugin-catch-links": "^2.3.9", 29 | "gatsby-plugin-compile-es6-packages": "^2.1.0", 30 | "gatsby-plugin-mdx": "^1.0.4", 31 | "gatsby-plugin-preload-fonts": "^1.2.28", 32 | "gatsby-plugin-react-helmet": "^3.0.12", 33 | "gatsby-plugin-sharp": "^2.10.1", 34 | "gatsby-plugin-simple-analytics": "^1.0.3", 35 | "gatsby-plugin-theme-ui": "^0.4.0-rc.1", 36 | "gatsby-remark-copy-linked-files": "^2.6.0", 37 | "gatsby-remark-images": "^3.7.1", 38 | "gatsby-source-filesystem": "^2.3.16", 39 | "netlify-identity-widget": "^1.9.1", 40 | "prismjs": "^1.21.0", 41 | "react": "^16.8.6", 42 | "react-dom": "^16.8.6", 43 | "react-helmet": "^5.2.0", 44 | "react-icons": "^3.11.0", 45 | "react-live": "^2.1.2", 46 | "react-use-auth": "^1.0.0", 47 | "remark-slug": "^6.0.0", 48 | "stringify-object": "^3.3.0", 49 | "theme-ui": "^0.4.0-rc.1", 50 | "typeface-asap": "^1.1.13", 51 | "typeface-roboto": "^1.1.13" 52 | }, 53 | "devDependencies": { 54 | "@babel/register": "^7.8.6", 55 | "babel-eslint": "^10.1.0", 56 | "eslint": "^7.6.0", 57 | "eslint-config-airbnb": "^18.2.0", 58 | "eslint-config-prettier": "^6.11.0", 59 | "eslint-plugin-import": "^2.22.0", 60 | "eslint-plugin-jsx-a11y": "^6.3.1", 61 | "eslint-plugin-prettier": "^3.1.4", 62 | "eslint-plugin-react": "^7.20.5", 63 | "eslint-plugin-react-hooks": "^4.0.8", 64 | "prettier": "^2.0.5", 65 | "repng": "^3.2.0" 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /examples/useAuth.dev/src/components/banner.js: -------------------------------------------------------------------------------- 1 | /** @jsx jsx */ 2 | import { Container, jsx, ThemeProvider } from 'theme-ui' 3 | 4 | export default props => ( 5 | 24 |
29 | {props.children} 30 |
31 |
32 | ) -------------------------------------------------------------------------------- /examples/useAuth.dev/src/components/button.js: -------------------------------------------------------------------------------- 1 | /** @jsx jsx */ 2 | import { jsx } from "theme-ui"; 3 | 4 | export default (props) => 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | ); 65 | }; 66 | 67 | export default Intro; 68 | -------------------------------------------------------------------------------- /examples/useAuth.dev/src/components/menu-button.js: -------------------------------------------------------------------------------- 1 | /** @jsx jsx */ 2 | import { jsx } from 'theme-ui' 3 | 4 | const Burger = ({ size = '1em' }) => ( 5 | 15 | 16 | 17 | ) 18 | 19 | export default (props) => ( 20 | 38 | ) -------------------------------------------------------------------------------- /examples/useAuth.dev/src/components/nav-link.js: -------------------------------------------------------------------------------- 1 | /** @jsx jsx */ 2 | import { Link } from 'gatsby' 3 | import isAbsoluteURL from 'is-absolute-url' 4 | import { jsx } from 'theme-ui' 5 | 6 | const styles = { 7 | variant: 'links.nav', 8 | } 9 | 10 | export default ({ href, ...props }) => { 11 | const isExternal = isAbsoluteURL(href || '') 12 | if (isExternal) { 13 | return 14 | } 15 | const to = props.to || href 16 | return 17 | } -------------------------------------------------------------------------------- /examples/useAuth.dev/src/components/note.js: -------------------------------------------------------------------------------- 1 | /** @jsx jsx */ 2 | import { jsx } from 'theme-ui' 3 | 4 | export default props => ( 5 |