@rss/auth-react
v0.0.5
Published
auth module for react
Downloads
1
Readme
@rss/auth-react
Helper library for working with token server on react
Installation
$ yarn add @rss/auth-react
Client Usage (react)
Initialize
Client.checkIfAuthenticated should be call in the app.component
import React from "react";
const Wrapper = () => {
Client.checkIfAuthenticated("URL_TO_AUTHENTICATE_USER");
return <App />;
};
Client API
Client.checkIfAuthenticated('URL_TO_AUTHENTICATE_USER')
check if user is authenticate. if not, redirect user to authentication url
Client.getUserToken()
get user token if available
Client.redirectToAuthentication('URL_TO_AUTHENTICATE_USER')
redirect user to token server for authentication