1.1.0 • Published 2 years ago

@freevuehub/auth v1.1.0

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

Reacth (React-Auth)

Installation

NPM: npm install @freevuehub/reacth --save

Yarn: yarn add @freevuehub/reacth

Usage

Google

import React from 'react'
import { Google } from '@freevuehub/reacth'

const CLIENT_KEY = '<Google OAuth Client Key>'
const App: React.FC = (props) => {
  return (
    <Google.Provider client-key={CLIENT_KEY}>
      {props.children}
    </Google.Provider>
  )
}
import React, { useContext } from 'react'
import { Google } from '@freevuehub/reacth'

const Home: React.FC = (props) => {
  const { signIn, signOut, user } = useContext(Google.Context)
  
  const onSignInClick = async (event: React.MouseEvent<HTMLButtonElement>) => {
    event.preventDefault()
    
    await signIn()
  }
  const onSignOutClick = async (event: React.MouseEvent<HTMLButtonElement>) => {
    event.preventDefault()

    await signOut()
  }
  
  return (
    <>
      <div>
        <button onClick={onSignInClick}>Sign In</button>
        <button onClick={onSignOutClick}>Sign Out</button>
      </div>
      <h1>{user.name}</h1>
    </>
  )
}

User Response Data

KeyType
idInt
nameString
emailString
imageString
1.1.0

2 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.6.1

3 years ago

0.6.0

3 years ago

0.5.0

3 years ago

0.1.18

3 years ago

0.1.17

3 years ago

0.1.16

3 years ago

0.1.15

3 years ago

0.1.14

3 years ago

0.1.13

3 years ago

0.1.12

3 years ago

0.1.11

3 years ago

0.1.10

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6-beta3

3 years ago

0.1.6-beta2

3 years ago

0.1.6-beta

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago