loginplify
v0.0.20
Published
React components to help you integrate a login flow into your application.
Readme
Getting Started
NOTE: Please make sure you have deployed your Loginplify server before using this component library
Installation
$ npm i loginplifyAdd authentication on a page on your React application
import * as React from 'react'
import { withAuthenticator } from 'loginplify'
const settings = {
endpoint: 'https://loginplify.mydomain.se/graphql'
}
const ProtectedPage = () => {
return (
<div>
<h1>This is private content</h1>
</div>
)
}
export default withAuthenticator(ProtectedPage, settings)Logout
import * as React from 'react'
import { withAuthenticator, useLoginServiceContext } from 'loginplify'
const settings = {
endpoint: 'https://loginplify.mydomain.se/graphql'
}
const ProtectedPage = () => {
const { actions } = useLoginServiceContext()
return (
<div>
<h1>This is private content</h1>
<button onClick={() => actions.logout()}>Logout</button>
</div>
)
}
export default withAuthenticator(ProtectedPage, settings)