Skip to content

Conversation

@notable-franco
Copy link

@notable-franco notable-franco commented Jun 20, 2022

When using the onelogin-node-sdk library to integrate oneLogin to our product we ended up with a situation where we needed to add scopes to get access to custom parameters that our application in oneLogin includes. but the library in its current state uses only the openid scope with no way of adding more.
This change allows the library to set custom scopes via the Configure method of a pkce object. these scopes are added after the openid scope (because that is a required scope).

@Subterrane Subterrane requested a review from Copilot November 22, 2025 00:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enables custom OAuth scopes when creating authorization URLs in the onelogin-node-sdk. Previously, the library hardcoded the openid scope with no mechanism to add additional scopes needed for custom application parameters.

Key Changes:

  • Adds optional scopes array parameter to PKCEConfig interface
  • Removes hardcoded QUERYPARAM_SCOPE constant
  • Constructs scope query parameter dynamically, appending custom scopes after required openid scope

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant