Skip to content
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

fix(provider): Add scope string array type #2511

Merged
merged 1 commit into from
Aug 12, 2021

Conversation

Liam-Tait
Copy link
Contributor

Reasoning 💡

Documentation and code already handles string[] for scope, this pr updates the typescript types to match the current functionality and usage.

See https://next-auth.js.org/configuration/providers#options for current docs

Checklist 🧢

  • Documentation
  • Tests
  • Ready to be merged

Documentation is already up to date
I don't think any tests are required.
This should be ready to be merged as soon as it is reviewed

Affected issues 🎟

@vercel
Copy link

vercel bot commented Aug 10, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/nextauthjs/next-auth/Gt81XZ5qWsH5i7LbYVUfRMCDmigp
✅ Preview: https://next-auth-git-fork-liam-tait-add-scope-array-type-nextauthjs.vercel.app

@vercel vercel bot temporarily deployed to Preview August 10, 2021 02:45 Inactive
@github-actions github-actions bot added the TypeScript Issues relating to TypeScript label Aug 10, 2021
Copy link
Collaborator

@ubbe-xyz ubbe-xyz left a comment

Choose a reason for hiding this comment

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

We use the Node oauth client for sign-in with providers, as you suggested, it does accept string[] for scope 👍🏽

@codecov-commenter
Copy link

Codecov Report

Merging #2511 (ec0377e) into main (be74dd0) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #2511   +/-   ##
=====================================
  Coverage   9.90%   9.90%           
=====================================
  Files         84      84           
  Lines       1403    1403           
  Branches     395     395           
=====================================
  Hits         139     139           
  Misses      1038    1038           
  Partials     226     226           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update be74dd0...ec0377e. Read the comment docs.

@balazsorban44
Copy link
Member

balazsorban44 commented Aug 12, 2021

@lluia
The current package does support it, but the one in v4 won't by default:

https://github.com/panva/node-openid-client/blob/772306cc82b72ace9361f4a945249a5c35a8f921/types/index.d.ts#L138

The question is what should we do?

  1. Merge this PR and don't apply it to the next branch.
  2. Merge this PR and implement support for string[] on next branch.
  3. Don't merge this PR, nothing to do.
  4. Merge and ask for support of string[] in openid-client (opened a discussion Support scope as an array panva/node-openid-client#385)

Current implementation:

scope: provider.scope,

next implementation:

params = { ...params, ...provider.authorization?.params }

Note that we don't do special handling for scope here.

Update My idea to add support for this in openid-client was welcome, so I'll open a PR there, and so hopefully this will be handled in v4 as well, without us needing to change anything. So this PR is good to go!

@balazsorban44 balazsorban44 merged commit 66d16f8 into nextauthjs:main Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TypeScript Issues relating to TypeScript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants