Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: explicitly support array of strings for AuthenticateHandler.options #309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
dhensby merged 1 commit into node-oauth:master from dhensby:pulls/scope-fix
Jul 30, 2024

Conversation

@dhensby
Copy link
Contributor

@dhensby dhensby commented Jul 24, 2024

Summary

In #267 some changes were made for compliance reasons where scopes should be treated as strings for our OAuth interfaces but as arrays of strings for internal purposes. As part of that change, we accidentally made the scope prop for the authenticate method only support strings.

This change remediates any potential backwards compatibility changes from v5.0 to v5.1

Linked issue(s)

#307 & #267

Involved parts of the project

authenticate handler

Added tests?

Copy link
Member

We should make clear that array scopes need to be trimmed etc. We do that with strings in parseScope but we do not validate if it's an array. Could there be any issues involved with array scopes?

Copy link
Contributor Author

dhensby commented Jul 24, 2024

We can introduce a "validate scopes" function that validates an array of scopes - I did think about this, but decided that would lean this towards a "feature" rather than a "fix" (and I wanted to go for a fix here).

Because this array of scopes if provided by the developer (or should be!) then I don't think there's such a risk to have malformed arrays of scopes. Do we validated the arrays of scopes that are provided in any other part of the library?

Copy link
Contributor Author

dhensby commented Jul 24, 2024

Just to touch on the typings too - we could just put it as scope?: string[] if we feel use of a string is to be deprecated, because there's no need for the typings to include deprecated values and clearly the typings hadn't been causing problems for people up to now 😅

Lordfirespeed reacted with thumbs up emoji

Copy link
Contributor Author

dhensby commented Jul 25, 2024

I've made the small change which essentially reverts the change from #305 so that the typings reflect our ideal implementation.

I think that keeps things straightforward for implementors in TS and also means it's less likely users will need to perform refactors when we do remove the string support if they've been following the types.

Lordfirespeed reacted with thumbs up emoji

Copy link
Contributor

Lordfirespeed commented Jul 28, 2024
edited
Loading

Any blockers here/on a release? At the moment I'm relying on

"foo" as unknown as string[]

Which is a bit of a code-smell, to say the least 😅

Copy link
Member

@Lordfirespeed I'm back at the office tomorrow and will then release an RC that reflects on all recent PRs.

Copy link
Contributor

@Lordfirespeed I'm back at the office tomorrow

Awesome! Thanks very much ♥️ hope your holidays have been restful & enjoyable

In node-oauth#267 some changes were made for compliance reasons where scopes should be treated
as strings for our OAuth interfaces but as arrays of strings for internal purposes.
As part of that change, we accidentally made the `scope` prop for the `authenticate`
method only support strings.
This change remediates any potential backwards compatibility changes from v5.0 to
v5.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jorenvandeweyer jorenvandeweyer jorenvandeweyer approved these changes

@Uzlopak Uzlopak Awaiting requested review from Uzlopak

@HappyZombies HappyZombies Awaiting requested review from HappyZombies

@jankapunkt jankapunkt Awaiting requested review from jankapunkt

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /