1.1.0 • Published 1 year ago

@freevuehub/auth v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year 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

1 year ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.6.1

2 years ago

0.6.0

2 years ago

0.5.0

2 years ago

0.1.18

2 years ago

0.1.17

2 years ago

0.1.16

2 years ago

0.1.15

2 years ago

0.1.14

2 years ago

0.1.13

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6-beta3

2 years ago

0.1.6-beta2

2 years ago

0.1.6-beta

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago