react-oauth2-code-pkce
Advanced tools
Comparing version 1.8.2 to 1.8.3
@@ -84,2 +84,3 @@ "use strict"; | ||
function redirectToLogout(config, token) { | ||
var _a; | ||
const params = new URLSearchParams({ | ||
@@ -91,3 +92,3 @@ token: token, | ||
// TODO: Add extra logout params | ||
post_logout_redirect_uri: config.redirectUri, | ||
post_logout_redirect_uri: (_a = config.logoutRedirect) !== null && _a !== void 0 ? _a : config.redirectUri, | ||
}); | ||
@@ -94,0 +95,0 @@ window.location.replace(`${config.logoutEndpoint}?${params.toString()}`); |
@@ -15,7 +15,7 @@ import { ReactNode } from 'react'; | ||
} | ||
export declare type TTokenRequest = TTokenRequestWithCodeAndVerifier | TTokenRequestForRefresh; | ||
export declare type TTokenData = { | ||
export type TTokenRequest = TTokenRequestWithCodeAndVerifier | TTokenRequestForRefresh; | ||
export type TTokenData = { | ||
[x: string]: any; | ||
}; | ||
export declare type TTokenResponse = { | ||
export type TTokenResponse = { | ||
access_token: string; | ||
@@ -42,3 +42,3 @@ scope: string; | ||
} | ||
export declare type TAuthConfig = { | ||
export type TAuthConfig = { | ||
clientId: string; | ||
@@ -66,10 +66,10 @@ authorizationEndpoint: string; | ||
}; | ||
export declare type TRefreshTokenExpiredEvent = { | ||
export type TRefreshTokenExpiredEvent = { | ||
login: () => void; | ||
}; | ||
export declare type TAzureADErrorResponse = { | ||
export type TAzureADErrorResponse = { | ||
error_description: string; | ||
[k: string]: unknown; | ||
}; | ||
export declare type TInternalConfig = { | ||
export type TInternalConfig = { | ||
clientId: string; | ||
@@ -81,2 +81,3 @@ authorizationEndpoint: string; | ||
logoutEndpoint?: string; | ||
logoutRedirect?: string; | ||
preLogin?: () => void; | ||
@@ -83,0 +84,0 @@ postLogin?: () => void; |
{ | ||
"name": "react-oauth2-code-pkce", | ||
"version": "1.8.2", | ||
"version": "1.8.3", | ||
"description": "Plug-and-play react package for OAuth2 Authorization Code flow with PKCE", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -59,3 +59,3 @@ # react-oauth2-code-pkce · [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/soofstad/react-oauth2-pkce/blob/main/LICENSE) [![npm version](https://img.shields.io/npm/v/react-oauth2-code-pkce)](https://www.npmjs.com/package/react-oauth2-code-pkce) ![CI](https://github.com/soofstad/react-oauth2-pkce/actions/workflows/tests.yaml/badge.svg) | ||
For instance, it's recommended to add a "Session expired"-callback like so: | ||
`onRefreshTokenExpire: (event) => window.confirm('Session expired. Refresh page to continue using the site?') && event.login(),` | ||
`onRefreshTokenExpire: (event) => window.confirm('Session expired. Refresh page to continue using the site?') && event.login(),`. | ||
@@ -139,2 +139,15 @@ ## Install | ||
## Known issues | ||
### The page randomly refreshes in the middle of a session | ||
This will happen if you haven't provided a callback-function for the `onRefreshTokenExpire` config parameter, and the refresh token expires. | ||
You probably want to implement some kind of "alert/message/banner", saying that the session has expired and that the user needs to login again. | ||
Either by refreshing the page, or clicking a "Login-button". | ||
### After redirect back from auth provider with `?code`, no token request is made | ||
If you are using libraries that intercept any `fetch()`-requests made. For example `@tanstack/react-query`. That can cause | ||
issues for the _AuthProviders_ token fetching. This can be solved by _not_ wrapping the `<AuthProvider>` in any such library. | ||
## Develop | ||
@@ -141,0 +154,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34880
595
160