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

Support passing additional information to the Strategy for use during Verify #35

Closed
danalloway opened this issue Oct 17, 2021 · 1 comment · Fixed by #113
Closed

Support passing additional information to the Strategy for use during Verify #35

danalloway opened this issue Oct 17, 2021 · 1 comment · Fixed by #113
Labels
enhancement New feature or request

Comments

@danalloway
Copy link

I have a use-case where my datasource / service instance lives on the Remix AppContext object and is not available when the auth strategy gets initialized.

I would like to be able to pass in some additional parameters from the action/loader when I call auth.authenticate() and then make those parameters available on the verify function call

@sergiodxa sergiodxa added the enhancement New feature or request label Oct 17, 2021
@sergiodxa sergiodxa changed the title support passing additional information to the Strategy for use during Verify Support passing additional information to the Strategy for use during Verify Oct 28, 2021
@sergiodxa sergiodxa linked a pull request Dec 29, 2021 that will close this issue
@sergiodxa
Copy link
Owner

sergiodxa commented Dec 29, 2021

It has been a long time, but I just merged #113 which let strategies receive the context as an option from the authenticate method, so you can do:

export let action: ActionFunction = async ({ request, context }) => {
  return await authenticator.authenticate("strategy", request, {
    context, // this is new
    successRedirect: "/",
    failureRedirect: "/login"
  })
}

Right now, it's up to the strategy to use or not this context or make it available in the verify callback, but it should be possible to create a strategy using it yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants