1.1.1 • Published 2 years ago

@iedaas/react-auth v1.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

react-auth

Provide multiple authentication strategy. Presently it has only Google Sign In Strategy. We are planning to add more authentication strategy in near future.

NPM JavaScript Style Guide

Install

npm install --save @iedaas/react-auth

or

yarn add @iedaas/react-auth

Usage

import React, { useCallback } from 'react'

import { Auth } from 'react-auth'

const App = () => (
  <Auth
    apiUrl={process.env.REACT_APP_API_URL!}
    google={{ clientId: process.env.REACT_APP_GOOGLE_CLIENT_ID! }}
  >
    <h1>Logged in successfully</h1>
  </Auth>
)

export default App

Props

  • apiUrl: Base api endpoint
  • google: Google auth client id

Internal API Calls

  • it calls /verify to verify that user is authenticated or not.
  • it calls /authenticate to authenticate the user. Request payload { token: 'google token', authenticator: 'google'}

License

MIT © dhavalpzala