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 Dynamic Config #50

Open
harlan-zw opened this issue Feb 7, 2024 · 4 comments
Open

Support Dynamic Config #50

harlan-zw opened this issue Feb 7, 2024 · 4 comments
Labels
has-workaround question Further information is requested

Comments

@harlan-zw
Copy link
Contributor

Sometimes we won't know ahead of time the exact config to use for an oauth request, it would be nice if we could provide config as a function that takes the event property.

It's related to this issue: #48.

Bit edge case but I think it's a fairly simple change that provides much more flexibility.

config(event) {
  // do logic   
},
@atinux
Copy link
Owner

atinux commented Feb 17, 2024

What you can do in the meantime is to create an event handler that return the event handler:

export default eventHandler(async event => {
  // get your config ...
  const ghConfig = await getGHConfig(event)
  return oauth.githubEventHandler({
     config: ghConfig,
     onSuccess(event, result) {

     }
  })(event)
})

@atinux atinux added question Further information is requested has-workaround labels Feb 17, 2024
@kbarnesMCC
Copy link

kbarnesMCC commented Nov 6, 2024

Just chiming in; I'm also going to be using this workaround as I have a need for dynamic config.

FWIW, if/when this supports gets implemented directly could consider rephrasing the handleMissingConfiguration error message to indicate it's not necessarily the NUXT_OAUTH... variables that aren't set; rather the config options haven't been passed.

@atinux
Copy link
Owner

atinux commented Nov 11, 2024

Please checkout #277 (comment) for also another example

@atinux
Copy link
Owner

atinux commented Nov 11, 2024

Just chiming in; I'm also going to be using this workaround as I have a need for dynamic config.

FWIW, if/when this supports gets implemented directly could consider rephrasing the handleMissingConfiguration error message to indicate it's not necessarily the NUXT_OAUTH... variables that aren't set; rather the config options haven't been passed.

Pull request is welcome to improve our error handling 💚

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has-workaround question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants