GithubHelp home page GithubHelp logo

marketertechnologies / react-oauth2-pkce Goto Github PK

View Code? Open in Web Editor NEW

This project forked from christoph-bittmann/react-oauth2-pkce

0.0 0.0 0.0 442 KB

React auth provider that works with AWS cognito PKCE🛡️🔒

JavaScript 0.86% TypeScript 88.61% CSS 1.99% HTML 8.54%

react-oauth2-pkce's Introduction

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 gardner#16 it is possible to pass in just provider or authorizeEndpoint, tokenEndpoint and logoutEndpoint. These two parameters were added to maintain backwards compatibility while enabling callers to customize the endpoint.

End User Session on "Single Application Logout"

You can end user session when calling logout(true). A custom endpoint can configured by passing logoutEndpoint as props. The user will be redirected to the redirectUri.

License

MIT © Gardner Bickford

react-oauth2-pkce's People

Contributors

gardner avatar dependabot[bot] avatar christoph-bittmann avatar t-knapp avatar thespivack avatar kraku avatar altenfreelance avatar nitescuc avatar jozefbabala avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.