[passport] Revert "add prompt options" as it is not a standard option
This reverts PR #24983. I agree that this option is useful, but it is not supported by default. Including it in the typing seems misleading to me. I've noticed that other non-standard options have also been merged, but at least they seem to be supported by more passport strategies than this one. For example, I noticed https://github.com/DefinitelyTyped/DefinitelyTyped/pull/21241#issuecomment-343101918 where the conclusion was that this change should be fine "for now", even though the option is only supported by some strategies?
The source for the property prompt in the PR was an answer on StackOverflow. The used strategy "passport-google-oauth20" supports the non-standard option prompt and includes it in the authorization request params (see relevant code within the package) The package relies on "passport-oauth2" which is more abstract and has a broader use but also does not utilize the property prompt. I added the link to the package "passport" with a list of valid options where this property does not occur at the end of this PR description.
In case you stumble over this PR and wonder how you could use the authorization request parameter prompt yourself (e. g. using "passport-oauth2") you could use the following code snippet to overwrite the otherwise empty method authorizationParams.
import OAuth2Strategy from 'passport-oauth2';
OAuth2Strategy.prototype.authorizationParams = (options) => ({ prompt: options.prompt });
I think the reason for the change back then was that you can't extend the typing for the passport strategy you're actually using. I think that would be a great feature, but of course that would be a major change.
Please fill in this template.
- [x] Use a meaningful title for the pull request. Include the name of the package modified.
- [x] Test the change in your own code. (Compile and run.)
- [x] Add or edit tests to reflect the change.
- [x] Follow the advice from the readme.
- [x] Avoid common mistakes.
- [x] Run
pnpm test <package to test>.
Select one of these and delete the others:
If changing an existing definition:
- [x] Provide a URL to documentation or source code which provides context for the suggested changes: https://github.com/jaredhanson/passport/blob/217018dbc46dcd4118dd6f2c60c8d97010c587f8/lib/authenticator.js#L149
- [ ] If this PR brings the type definitions up to date with a new version of the JS library, update the version number in the
package.json.
@GeniusTimo Thank you for submitting this PR! I see this is your first time submitting to DefinitelyTyped 👋 — I'm the local bot who will help you through the process of getting things through.
This is a live comment that I will keep updated.
1 package in this PR
Code Reviews
Because this is a widely-used package, a DT maintainer will need to review it before it can be merged.
You can test the changes of this PR in the Playground.
Status
- ✅ No merge conflicts
- ✅ Continuous integration tests have passed
- ✅ Only a DT maintainer can approve changes without tests
All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes.
Diagnostic Information: What the bot saw about this PR
{
"type": "info",
"now": "-",
"pr_number": 70626,
"author": "GeniusTimo",
"headCommitOid": "019f5224c47e45a5f6e8ac20c51aaf84c5ec87e4",
"mergeBaseOid": "6aa33e30af455c5d307a0c0740fb79e258d69fd6",
"lastPushDate": "2024-09-20T20:57:35.000Z",
"lastActivityDate": "2024-10-28T20:14:35.000Z",
"mergeOfferDate": "2024-10-28T20:12:24.000Z",
"mergeRequestDate": "2024-10-28T20:14:35.000Z",
"mergeRequestUser": "GeniusTimo",
"hasMergeConflict": false,
"isFirstContribution": true,
"tooManyFiles": false,
"hugeChange": false,
"popularityLevel": "Critical",
"pkgInfo": [
{
"name": "passport",
"kind": "edit",
"files": [
{
"path": "types/passport/index.d.ts",
"kind": "definition"
}
],
"owners": [
"horiuchi",
"enaeseth",
"theigor",
"tlaziuk",
"unindented",
"kstiehl",
"vaskevich"
],
"addedOwners": [],
"deletedOwners": [],
"popularityLevel": "Critical"
}
],
"reviews": [
{
"type": "approved",
"reviewer": "gabritto",
"date": "2024-10-28T20:11:46.000Z",
"isMaintainer": true
}
],
"mainBotCommentID": 2364608085,
"ciResult": "pass"
}
Hey @GeniusTimo,
:unamused: Your PR doesn't modify any tests, so it's hard to know what's being fixed, and your changes might regress in the future. Please consider adding tests to cover the change you're making. Including tests allows this PR to be merged by yourself and the owners of this module.
This can potentially save days of time for you!
🔔 @horiuchi @enaeseth @theigor @tlaziuk @unindented @kstiehl @vaskevich — please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.
The linked PR was merged 6 years ago; can we be sure someone isn't relying on this prop? This is a heavily used package, so not breaking it is important.
Unfortunately, I think that's right. In general this is complicated as it depends on which strategy is used and this is not part of the current implementation at all. The property "prompt" is supported but many properties of other well-known passport strategies are not supported. Perhaps a comment can at least clarify this for those that are searching the source code of passport for the "prompt" property (as I did)? Alternatively, is it possible to allow more properties and point out that what is supported depends on the strategy used? It would then be backwards compatible and also open to other valid use cases. I think this is beyond my foresight, I just wanted to raise my thoughts here and suggest an approach that came to my mind.
Sure. This PR is new, so I'll give it a little time for the package owners to comment.
Re-ping @horiuchi, @enaeseth, @theigor, @tlaziuk, @unindented, @kstiehl, @vaskevich:
This PR has been out for over a week, yet I haven't seen any reviews.
Could someone please give it some attention? Thanks!
It has been more than two weeks and this PR still has no reviews.
I'll bump it to the DT maintainer queue. Thank you for your patience, @GeniusTimo.
(Ping @horiuchi, @enaeseth, @theigor, @tlaziuk, @unindented, @kstiehl, @vaskevich.)
@GeniusTimo One or more reviewers has requested changes. Please address their comments. I'll be back once they sign off or you've pushed new commits. Thank you!
@gabritto Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review?
@GeniusTimo: Everything looks good here. I am ready to merge this PR (at 019f522) on your behalf whenever you think it's ready.
If you'd like that to happen, please post a comment saying:
Ready to merge
and I'll merge this PR almost instantly. Thanks for helping out! :heart:
(@horiuchi, @enaeseth, @theigor, @tlaziuk, @unindented, @kstiehl, @vaskevich: you can do this too.)
Ready to merge