d6721676ca
* Add an example for Fauna using cookie based auth. * Update example to use more secure method of non-js cookie and all authed access via backend api calls. * Updated README * Updated files and added prettier * Remove unused import to fix lint issue. * Improve documentation on how to setup fauna. Remove client key to simplify setup. * Remove semicolons * Lint fix * Updated readme instructions and deployment * Fixed client side redirect issue with /profile * Simplified login code * Simplified signup code * Removed isomorphic-unfetch * Simplified logout * Removed get-host file * Removed the custom getInitialProps from withAuthSync * Removed user email from localStorage Co-authored-by: Luis Alvarez D. <luis@zeit.co>
29 lines
689 B
JavaScript
29 lines
689 B
JavaScript
import React from 'react'
|
|
import Layout from '../components/layout'
|
|
|
|
const Home = () => (
|
|
<Layout>
|
|
<h1>Cookie-based authentication example</h1>
|
|
|
|
<p>Steps to test the functionality:</p>
|
|
|
|
<ol>
|
|
<li>Click signup and create an account, this will also log you in.</li>
|
|
<li>
|
|
Click home and click profile again, notice how your session is being
|
|
used through a token stored in a cookie.
|
|
</li>
|
|
<li>
|
|
Click logout and try to go to profile again. You'll get redirected to
|
|
the `/login` route.
|
|
</li>
|
|
</ol>
|
|
<style jsx>{`
|
|
li {
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
`}</style>
|
|
</Layout>
|
|
)
|
|
|
|
export default Home
|