0.0.12 • Published 4 years ago

@bendcircular/react-ic-ii-auth v0.0.12

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

react-ic-ii-auth


⚠️ DEPRECATED ⚠️

use @identity-labs/react-ic-ii-auth insead


React components to use DFINITY Internet Identity Authentication

NPM JavaScript Style Guide

Install

npm install --save @bendcircular/react-ic-ii-auth

Usage

import React from 'react'

import {
  InternetIdentityProvider,
  useInternetIdentity
} from '@bendcircular/react-ic-ii-auth'

const AuthButthon = () => {
  const { authenticate, isAuthenticated, identity } = useInternetIdentity()
  console.log('>> initialize your actors with', { identity })
  return (
    <button onClick={authenticate}>
      {isAuthenticated ? 'Logout' : 'Login'}
    </button>
  )
}

const App = () => {
  return (
    <InternetIdentityProvider
      authClientOptions={{
        onSuccess: (identity) => console.log(
          ">> initialize your actors with", {identity}
        )
        // NOTE: Overwrite identityProvider in dev mode
        // defaults to "https://identity.ic0.app/#authorize"
        identityProvider: `http://${process.env.II_CANISTER_ID}.localhost:8000/#authorize`
      }}
    >
      <AuthButthon />
    </InternetIdentityProvider>
  )
}

export default App

Inspired by:

License

MIT © bendcircular GmbH

0.0.11

4 years ago

0.0.12

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago