Napoleon's Pixelated Mugshot

    react-oauth2-state
    TypeScript icon, indicating that this package has built-in type declarations

    2.1.0 • Public • Published

    react-oauth2-pkce

    Authenticate against generic OAuth2 using PKCE

    NPM JavaScript Style Guide

    Install

    npm install --save react-oauth2-pkce

    Usage

    import React from 'react'
    import { AuthProvider, AuthService } from 'react-oauth2-pkce'
    
    import { Routes } from './Routes';
    
    const authService = new AuthService({
      clientId: process.env.REACT_APP_CLIENT_ID || 'CHANGEME',
      location: window.location,
      provider: process.env.REACT_APP_PROVIDER || 'https://sandbox.auth.ap-southeast-2.amazoncognito.com/oauth2',
      redirectUri: process.env.REACT_APP_REDIRECT_URI || window.location.origin,
      scopes: ['openid', 'profile']
    });
    
    const App = () => {
      return (
        <AuthProvider authService={authService} >
          <Routes />
        </AuthProvider>
      )
    }
    
    export default App

    Custom Provider/Endpoint

    After https://github.com/gardner/react-oauth2-pkce/pull/16 it is possible to pass in just provider or authorizeEndpoint and tokenEndpoint. These two parameters were added to maintain backwards compatibility while enabling callers to customize the endpoint.

    License

    MIT © Gardner Bickford

    Install

    npm i react-oauth2-state

    DownloadsWeekly Downloads

    1

    Version

    2.1.0

    License

    MIT

    Unpacked Size

    74 kB

    Total Files

    15

    Last publish

    Collaborators

    • pacto_