react-oauth2-code-pkce
Advanced tools
Comparing version 1.20.1 to 1.20.2
@@ -1,3 +0,3 @@ | ||
import { TAuthConfig, TInternalConfig } from './types'; | ||
import type { TAuthConfig, TInternalConfig } from './types'; | ||
export declare function createInternalConfig(passedConfig: TAuthConfig): TInternalConfig; | ||
export declare function validateConfig(config: TInternalConfig): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateConfig = exports.createInternalConfig = void 0; | ||
exports.createInternalConfig = createInternalConfig; | ||
exports.validateConfig = validateConfig; | ||
function stringIsUnset(value) { | ||
@@ -15,3 +16,2 @@ const unset = ['', undefined, null]; | ||
} | ||
exports.createInternalConfig = createInternalConfig; | ||
function validateConfig(config) { | ||
@@ -35,2 +35,1 @@ if (stringIsUnset(config === null || config === void 0 ? void 0 : config.clientId)) | ||
} | ||
exports.validateConfig = validateConfig; |
import React from 'react'; | ||
import { IAuthContext, IAuthProvider } from './types'; | ||
import type { IAuthContext, IAuthProvider } from './types'; | ||
export declare const AuthContext: React.Context<IAuthContext>; | ||
export declare const AuthProvider: ({ authConfig, children }: IAuthProvider) => React.JSX.Element; |
@@ -94,3 +94,5 @@ "use strict"; | ||
setToken(response.access_token); | ||
setIdToken(response.id_token); | ||
if (response.id_token) { | ||
setIdToken(response.id_token); | ||
} | ||
let tokenExp = timeUtils_1.FALLBACK_EXPIRE_TIME; | ||
@@ -97,0 +99,0 @@ // Decode IdToken, so we can use "exp" from that as fallback if expire not returned in the response |
@@ -1,2 +0,2 @@ | ||
import { TInternalConfig, TPrimitiveRecord, TTokenResponse } from './types'; | ||
import type { TInternalConfig, TPrimitiveRecord, TTokenResponse } from './types'; | ||
export declare function redirectToLogin(config: TInternalConfig, customState?: string, additionalParameters?: TPrimitiveRecord, method?: 'popup' | 'redirect'): Promise<void>; | ||
@@ -3,0 +3,0 @@ export declare const fetchTokens: (config: TInternalConfig) => Promise<TTokenResponse>; |
@@ -12,3 +12,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateState = exports.redirectToLogout = exports.fetchWithRefreshToken = exports.fetchTokens = exports.redirectToLogin = void 0; | ||
exports.fetchWithRefreshToken = exports.fetchTokens = void 0; | ||
exports.redirectToLogin = redirectToLogin; | ||
exports.redirectToLogout = redirectToLogout; | ||
exports.validateState = validateState; | ||
const httpUtils_1 = require("./httpUtils"); | ||
@@ -51,3 +54,2 @@ const pkceUtils_1 = require("./pkceUtils"); | ||
} | ||
exports.redirectToLogin = redirectToLogin; | ||
// This is called a "type predicate". Which allow us to know which kind of response we got, in a type safe way. | ||
@@ -106,3 +108,2 @@ function isTokenResponse(body) { | ||
} | ||
exports.redirectToLogout = redirectToLogout; | ||
function validateState(urlParams, storageType) { | ||
@@ -116,2 +117,1 @@ const storage = storageType === 'session' ? sessionStorage : localStorage; | ||
} | ||
exports.validateState = validateState; |
@@ -1,2 +0,2 @@ | ||
import { TTokenData } from './types'; | ||
import type { TTokenData } from './types'; | ||
/** | ||
@@ -3,0 +3,0 @@ * Decodes the base64 encoded JWT. Returns a TToken. |
@@ -1,2 +0,2 @@ | ||
import { TTokenRequest } from './types'; | ||
import type { TTokenRequest } from './types'; | ||
export declare function postWithXForm(url: string, request: TTokenRequest): Promise<Response>; |
@@ -12,3 +12,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.postWithXForm = void 0; | ||
exports.postWithXForm = postWithXForm; | ||
const errors_1 = require("./errors"); | ||
@@ -37,2 +37,1 @@ function buildUrlEncodedRequest(request) { | ||
} | ||
exports.postWithXForm = postWithXForm; |
@@ -12,3 +12,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.generateCodeChallenge = exports.generateRandomString = exports.getRandomInteger = void 0; | ||
exports.getRandomInteger = getRandomInteger; | ||
exports.generateRandomString = generateRandomString; | ||
exports.generateCodeChallenge = generateCodeChallenge; | ||
function getRandomInteger(range) { | ||
@@ -24,3 +26,2 @@ const max_range = 256; // Highest possible number in Uint8 | ||
} | ||
exports.getRandomInteger = getRandomInteger; | ||
function generateRandomString(length) { | ||
@@ -34,3 +35,2 @@ let text = ''; | ||
} | ||
exports.generateRandomString = generateRandomString; | ||
/** | ||
@@ -56,2 +56,1 @@ * PKCE Code Challenge = base64url(hash(codeVerifier)) | ||
} | ||
exports.generateCodeChallenge = generateCodeChallenge; |
@@ -1,2 +0,2 @@ | ||
import { TTokenResponse } from './types'; | ||
import type { TTokenResponse } from './types'; | ||
export declare const FALLBACK_EXPIRE_TIME = 600; | ||
@@ -3,0 +3,0 @@ export declare const epochAtSecondsFromNow: (secondsFromNow: number | string) => number; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getRefreshExpiresIn = exports.epochTimeIsPast = exports.epochAtSecondsFromNow = exports.FALLBACK_EXPIRE_TIME = void 0; | ||
exports.epochAtSecondsFromNow = exports.FALLBACK_EXPIRE_TIME = void 0; | ||
exports.epochTimeIsPast = epochTimeIsPast; | ||
exports.getRefreshExpiresIn = getRefreshExpiresIn; | ||
exports.FALLBACK_EXPIRE_TIME = 600; // 10minutes | ||
@@ -18,3 +20,2 @@ // Returns epoch time (in seconds) for when the token will expire | ||
} | ||
exports.epochTimeIsPast = epochTimeIsPast; | ||
const refreshExpireKeys = [ | ||
@@ -35,2 +36,1 @@ 'refresh_expires_in', // KeyCloak | ||
} | ||
exports.getRefreshExpiresIn = getRefreshExpiresIn; |
@@ -1,2 +0,2 @@ | ||
import { ReactNode } from 'react'; | ||
import type { ReactNode } from 'react'; | ||
interface TTokenRqBase { | ||
@@ -3,0 +3,0 @@ grant_type: string; |
{ | ||
"name": "react-oauth2-code-pkce", | ||
"version": "1.20.1", | ||
"version": "1.20.2", | ||
"description": "Provider agnostic react package for OAuth2 Authorization Code flow with PKCE", | ||
@@ -42,5 +42,3 @@ "main": "dist/index.js", | ||
"homepage": "https://github.com/soofstad/react-oauth2-pkce#readme", | ||
"files": [ | ||
"dist/" | ||
] | ||
"files": ["dist/"] | ||
} |
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
51655
791