Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-oauth2-code-pkce

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-oauth2-code-pkce - npm Package Compare versions

Comparing version 1.22.1 to 1.22.2

3

dist/AuthContext.js

@@ -120,4 +120,3 @@ "use strict";

function handleExpiredRefreshToken(initial = false) {
// If it's the first page load, OR there is no sessionExpire callback, we trigger a new login
if (initial)
if (config.autoLogin && initial)
return logIn(undefined, undefined, config.loginMethod);

@@ -124,0 +123,0 @@ // TODO: Breaking change - remove automatic login during ongoing session

{
"name": "react-oauth2-code-pkce",
"version": "1.22.1",
"version": "1.22.2",
"description": "Provider agnostic react package for OAuth2 Authorization Code flow with PKCE",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -197,6 +197,27 @@ # react-oauth2-code-pkce

### Fails to compile with Next.js
The library's main componet `AuthProvider` is _client side only_. Meaning it must be rendered in a web browser, and can not be pre-rendered server-side (which is default in newer versions of NextJS and similar frameworks).
This library expects to have a `localStorage` (or `sessionStorage`) available. That is not the case when compiling Next.js projects serverside.
See: https://github.com/soofstad/react-oauth2-pkce/discussions/90 for a solution.
This can be solved by marking the module with `use client` and importing the component in the client only (`"ssr": false`).
```tsx
'use client'
import {useContext} from "react";
import dynamic from 'next/dynamic'
import {TAuthConfig,TRefreshTokenExpiredEvent, AuthContext} from 'react-oauth2-code-pkce'
const AuthProvider = dynamic(
()=> import("react-oauth2-code-pkce")
.then((mod) => mod.AuthProvider),
{ssr: false}
)
const authConfig: TAuthConfig = {...for you to fill inn}
export default function Authenticated() {
(<AuthProvider authConfig={authConfig}>
<LoginInfo/>
</AuthProvider>)
}
```
### Error `Bad authorization state...`

@@ -203,0 +224,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc