Skip to content

Conversation

Dunsin-cyber
Copy link
Contributor

@Dunsin-cyber Dunsin-cyber commented Oct 16, 2025

The OAuth scopes in getAuthClient found in examples/oauth/helper were previously hardcoded, making it inflexible. Adding new functionality that required different permissions, such as sending payments, necessitated modifying this core helper function directly.

This change refactors the function to accept an optional additionalScopes array.

Resolves: #488

@Dunsin-cyber Dunsin-cyber changed the title feat(auth): Allow passing additional scopes to getAuthClient feat(auth): Allow passing additional scopes to getAuthClient in example helper function Oct 16, 2025
@Dunsin-cyber Dunsin-cyber changed the title feat(auth): Allow passing additional scopes to getAuthClient in example helper function feat(auth): Allow passing additional scopes to getAuthClient in examples helper function Oct 16, 2025
@Dunsin-cyber Dunsin-cyber changed the title feat(auth): Allow passing additional scopes to getAuthClient in examples helper function Allow passing additional scopes to getAuthClient in examples helper function Oct 16, 2025
@Dunsin-cyber Dunsin-cyber changed the title Allow passing additional scopes to getAuthClient in examples helper function fix: Allow passing additional scopes to getAuthClient in examples helper function Oct 16, 2025
@Dunsin-cyber Dunsin-cyber marked this pull request as ready for review October 16, 2025 11:00
callback: "http://localhost:8080",
scopes: ["invoices:read", "account:read", "balance:read"],
scopes: [
"invoices:read", // At least one scope is required to get an access token.
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be better if all examples pass the scopes they need? because then there isn't the case where they have this scope when they don't need it, or if we want to test a case where the token does not have read permissions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

alright.

yea, I wanted to follow that approach too, but I was trying to avoid having to add comments to most examples explaining that "invoice:read" isn’t actually required for the function, it’s just there because at least one permission needs to be passed.

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.

getAuthClient in examples helper function has hardcoded scopes, preventing the addition of new permissions

2 participants