{"repo":"authts/react-oidc-context","free":true,"listed":false,"github":"https://github.com/authts/react-oidc-context","clone":"git clone https://github.com/authts/react-oidc-context.git","description":"Lightweight auth library based on oidc-client-ts for React single page applications (SPA). Support for hooks and higher-order components (HOC).","language":"TypeScript","stars":1026,"topics":["oidc","react","oidc-client","spa","reactjs","hooks","typescript"],"license":"MIT","category":"auth-billing-email","readme_excerpt":"react-oidc-context Lightweight auth library using the oidc-client-ts library for React single page applications (SPA). Support for hooks and higher-order components (HOC). Table of Contents - Documentation - Installation - Getting Started - Contributing - Influences - License Documentation This library implements an auth context provider by making use of the oidc-client-ts library. Its configuration is tight coupled to that library. - oidc-client-ts The User and UserManager is held in this context, which is accessible from the React application. Additionally it intercepts the auth redirects by looking at the query/fragment parameters and acts accordingly. You still need to setup a redirect uri, which must point to your application, but you do not need to create that route. To renew the access token, the automatic silent renew feature of oidc-client-ts can be used. Installation Using npm Using yarn Getting Started Configure the library by wrapping your application in AuthProvider : Use the useAuth hook in your components to access authentication state ( isLoading , isAuthenticated and user ) and authentication methods ( signinRedirect , removeUser and signOutRedirect ): You must provide an implementation of onSigninCallback to oidcConfig to remove the payload from the URL upon successful login. Otherwise if you refresh the page and the payload is still there, signinSilent - which handles renewing your token - won't work. A working implementation is already in the code here. Us","default_branch":null,"files":null,"tree":[],"storefront":"/r/authts","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/authts/react-oidc-context/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}