Next Auth Client
This a client for an upcoming module called next-auth
.
It is an isometric library designed for use with React.
You can use it in Next.js projects to add authentication to your site.
Example usage
import React from 'react'
import { Session } from 'next-auth-client'
export default class extends React.Component {
static async getInitialProps({req}) {
return {
session: await Session.init({req})
}
}
render() {
if (this.props.session.user) {
return(
<div>
<p>You are logged in as {this.props.session.user.name || this.props.session.user.email}.</p>
</div>
)
} else {
return(
<div>
<p>You are not logged in.</p>
</div>
)
}
}
}
Additional usage information and examples will follow once the next-auth
module is live.
-- January 2018