Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/react-auth/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.0.21 - 2025-11-25

### Changed

- Support onRedirectCallback parameter

## 0.0.20 - 2025-11-19
Comment thread
kenany marked this conversation as resolved.

### Changed

- Upgraded @pangeacyber/vanilla-js auth client version

## 0.0.19 - 2025-11-19

### Changed
Expand Down
2 changes: 1 addition & 1 deletion packages/react-auth/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@pangeacyber/react-auth",
"description": "Pangea auth provider React component",
"version": "0.0.19",
"version": "0.0.21",
"type": "commonjs",
"source": "src/index.ts",
"main": "dist/index.cjs",
Expand Down
19 changes: 17 additions & 2 deletions packages/react-auth/src/AuthProvider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ export interface AuthProviderProps {
*/
redirectPathname?: string;

/**
* When passed in, AuthProvider will call this function when needing to redirect
* @example "/docs/""
*/
onRedirectCallback?: (url: string) => void;

/**
* When set to true users will be redirected to the hosted page on logout.
*
Expand Down Expand Up @@ -152,6 +158,7 @@ export const AuthProvider: FC<AuthProviderProps> = ({
cookieOptions = { useCookie: false },
redirectUri,
redirectPathname,
onRedirectCallback,
redirectOnLogout = false,
useStrictStateCheck = true,
passAuthMethod = false,
Expand Down Expand Up @@ -378,7 +385,11 @@ export const AuthProvider: FC<AuthProviderProps> = ({
const redirectTo = loginURL;
const url = queryParams ? `${redirectTo}?${queryParams}` : redirectTo;

window.location.replace(url);
if (onRedirectCallback) {
onRedirectCallback(url);
} else {
window.location.replace(url);
}
};

const logout = useCallback(async () => {
Expand All @@ -400,7 +411,11 @@ export const AuthProvider: FC<AuthProviderProps> = ({
const url = `${logoutURL}?${toUrlEncoded(query)}`;

setLoggedOut();
window.location.replace(url);
if (onRedirectCallback) {
onRedirectCallback(url);
} else {
window.location.replace(url);
}
}
// call the logout endpoint
else {
Expand Down
2 changes: 1 addition & 1 deletion packages/vanilla-js/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.16] - 2025-11-19
## [0.1.17] - 2025-11-19
Comment thread
kenany marked this conversation as resolved.

### Added

Expand Down
2 changes: 1 addition & 1 deletion packages/vanilla-js/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@pangeacyber/vanilla-js",
"description": "Generic javascript integrations with Pangea",
"version": "0.1.16",
"version": "0.1.17",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/index.d.ts",
Expand Down
4 changes: 4 additions & 0 deletions packages/vanilla-js/src/AuthNClient/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ export class AuthNClient {
}

if (!!this.config.apiPathPrefix) {
if (this.config.apiPathPrefix.startsWith("http")) {
Comment thread
kenany marked this conversation as resolved.
return `${this.config.apiPathPrefix}${version_}${endpoint}`;
}

return `${window.location.origin}${this.config.apiPathPrefix}${version_}${endpoint}`;
}

Expand Down
Loading