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
1 change: 1 addition & 0 deletions dist/onelogin/use_cases/pkce.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { HTTPClient } from '../../http_clients/interface';
interface PKCEConfig {
redirectURL: string;
clientID: string;
scopes?: Array<string>;
}
interface AccessToken {
access_token: string;
Expand Down
5 changes: 2 additions & 3 deletions dist/onelogin/use_cases/pkce.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/onelogin/use_cases/pkce.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions lib/onelogin/use_cases/pkce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import qs from "qs";
const LOCALSTORE_AUTH_URL_KEY = "auth-url";
const LOCALSTORE_CODE_VERIFIER_KEY = "code-verifier";

const QUERYPARAM_SCOPE = "scope=openid";
const QUERYPARAM_RESPONSE_TYPE = "response_type=code";
const QUERYPARAM_CODE_CHALLENGE_METHOD = "code_challenge_method=S256";

Expand All @@ -18,7 +17,8 @@ const MISSING_CONFIG_MESSAGE = "The PKCE Client is Missing Configuration Paramet

interface PKCEConfig {
redirectURL: string,
clientID: string
clientID: string,
Copy link

Copilot AI Nov 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The scopes property lacks documentation explaining its purpose and that 'openid' is automatically included. Add a JSDoc comment to clarify that this array should contain additional scopes beyond 'openid', which is always present by default.

Suggested change
clientID: string,
clientID: string,
/**
* Additional scopes to request during authentication.
* 'openid' is always included by default; specify only extra scopes here.
*/

Copilot uses AI. Check for mistakes.
scopes?: Array<string>,
}

interface AccessToken {
Expand Down Expand Up @@ -64,13 +64,13 @@ export default class PKCE {
let codeVerifier = this._createCodeVerifier( 50 );
let codeChallenge = await this._createCodeChallenge( codeVerifier );

let { clientID, redirectURL } = this.configuration
let { clientID, redirectURL, scopes } = this.configuration
if(overrideRedirectURL)
redirectURL = overrideRedirectURL;

let queryParams = [
`code_challenge=${codeChallenge}`, `client_id=${clientID}`, `redirect_uri=${redirectURL}`,
QUERYPARAM_CODE_CHALLENGE_METHOD, QUERYPARAM_RESPONSE_TYPE, QUERYPARAM_SCOPE
QUERYPARAM_CODE_CHALLENGE_METHOD, QUERYPARAM_RESPONSE_TYPE, `scope=openid${scopes ? ` ${scopes.join(" ")}` : ''}`
Copy link

Copilot AI Nov 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inline scope string construction is complex and hard to read. Consider extracting this logic into a separate method like _buildScopeParam(scopes?: Array<string>): string that constructs the scope parameter with 'openid' as the base and appends custom scopes if provided.

Copilot uses AI. Check for mistakes.
];

localStorage.setItem(LOCALSTORE_CODE_VERIFIER_KEY, codeVerifier);
Expand Down