New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.17.2 to 1.18.0

6

dist/AuthContext.js

@@ -72,3 +72,3 @@ "use strict";

}
function login(state) {
function login(state, additionalParameters) {
clearStorage();

@@ -82,3 +82,3 @@ setLoginInProgress(true);

}
(0, authentication_1.redirectToLogin)(config, typeSafePassedState).catch((error) => {
(0, authentication_1.redirectToLogin)(config, typeSafePassedState, additionalParameters).catch((error) => {
console.error(error);

@@ -232,3 +232,3 @@ setError(error.message);

// Clear ugly url params
window.history.replaceState(null, '', window.location.pathname);
window.history.replaceState(null, '', `${window.location.pathname}${window.location.hash}`);
}

@@ -235,0 +235,0 @@ setLoginInProgress(false);

@@ -1,3 +0,3 @@

import { TInternalConfig, TTokenResponse } from './Types';
export declare function redirectToLogin(config: TInternalConfig, customState?: string): Promise<void>;
import { TInternalConfig, TPrimitiveRecord, TTokenResponse } from './Types';
export declare function redirectToLogin(config: TInternalConfig, customState?: string, additionalParameters?: TPrimitiveRecord): Promise<void>;
export declare const fetchTokens: (config: TInternalConfig) => Promise<TTokenResponse>;

@@ -4,0 +4,0 @@ export declare const fetchWithRefreshToken: (props: {

@@ -17,3 +17,3 @@ "use strict";

const stateStorageKey = 'ROCP_auth_state';
function redirectToLogin(config, customState) {
function redirectToLogin(config, customState, additionalParameters) {
return __awaiter(this, void 0, void 0, function* () {

@@ -27,4 +27,4 @@ const storage = config.storage === 'session' ? sessionStorage : localStorage;

// Set query parameters and redirect user to OAuth2 authentication endpoint
const params = new URLSearchParams(Object.assign({ response_type: 'code', client_id: config.clientId, redirect_uri: config.redirectUri, code_challenge: codeChallenge, code_challenge_method: 'S256' }, config.extraAuthParameters));
if (config.scope !== undefined) {
const params = new URLSearchParams(Object.assign(Object.assign({ response_type: 'code', client_id: config.clientId, redirect_uri: config.redirectUri, code_challenge: codeChallenge, code_challenge_method: 'S256' }, config.extraAuthParameters), additionalParameters));
if (config.scope !== undefined && !params.has('scope')) {
params.append('scope', config.scope);

@@ -31,0 +31,0 @@ }

@@ -37,4 +37,4 @@ "use strict";

function generateCodeChallenge(codeVerifier) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
var _a;
if (!((_a = window.crypto.subtle) === null || _a === void 0 ? void 0 : _a.digest)) {

@@ -41,0 +41,0 @@ throw new Error("The context/environment is not secure, and does not support the 'crypto.subtle' module. See: https://developer.mozilla.org/en-US/docs/Web/API/Crypto/subtle for details");

@@ -36,3 +36,3 @@ import { ReactNode } from 'react';

logOut: (state?: string, logoutHint?: string) => void;
login: (state?: string) => void;
login: (state?: string, additionalParameters?: TPrimitiveRecord) => void;
error: string | null;

@@ -44,2 +44,5 @@ tokenData?: TTokenData;

}
export type TPrimitiveRecord = {
[key: string]: string | boolean | number;
};
export type TAuthConfig = {

@@ -60,14 +63,6 @@ clientId: string;

clearURL?: boolean;
extraAuthParams?: {
[key: string]: string | boolean | number;
};
extraAuthParameters?: {
[key: string]: string | boolean | number;
};
extraTokenParameters?: {
[key: string]: string | boolean | number;
};
extraLogoutParameters?: {
[key: string]: string | boolean | number;
};
extraAuthParams?: TPrimitiveRecord;
extraAuthParameters?: TPrimitiveRecord;
extraTokenParameters?: TPrimitiveRecord;
extraLogoutParameters?: TPrimitiveRecord;
tokenExpiresIn?: number;

@@ -97,14 +92,6 @@ refreshTokenExpiresIn?: number;

clearURL: boolean;
extraAuthParams?: {
[key: string]: string | boolean | number;
};
extraAuthParameters?: {
[key: string]: string | boolean | number;
};
extraTokenParameters?: {
[key: string]: string | boolean | number;
};
extraLogoutParameters?: {
[key: string]: string | boolean | number;
};
extraAuthParams?: TPrimitiveRecord;
extraAuthParameters?: TPrimitiveRecord;
extraTokenParameters?: TPrimitiveRecord;
extraLogoutParameters?: TPrimitiveRecord;
tokenExpiresIn?: number;

@@ -111,0 +98,0 @@ refreshTokenExpiresIn?: number;

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

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

@@ -1,2 +0,3 @@

# react-oauth2-code-pkce &middot; [![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)
# 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?logo=npm&label=version) ![NPM Downloads](https://img.shields.io/npm/d18m/react-oauth2-code-pkce?logo=npm) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-oauth2-code-pkce?label=size) ![CI](https://github.com/soofstad/react-oauth2-pkce/actions/workflows/tests.yaml/badge.svg)

@@ -83,3 +84,3 @@ React package for OAuth2 Authorization Code flow with PKCE

// If you want to use 'state', you might want to set 'clearURL' configuration parameter to 'false'.
login: (state?: string) => void
login: (state?: string, additionalParameters?: { [key: string]: string | boolean | number }) => void
// Function to trigger logout from authentication provider. You may provide optional 'state', and 'logout_hint' values.

@@ -86,0 +87,0 @@ // See https://openid.net/specs/openid-connect-rpinitiated-1_0.html#RPLogout for details.

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