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

Allow supplying custom success, error handlers #10

Open
kaosko opened this issue Nov 18, 2017 · 5 comments
Open

Allow supplying custom success, error handlers #10

kaosko opened this issue Nov 18, 2017 · 5 comments

Comments

@kaosko
Copy link

kaosko commented Nov 18, 2017

Currently, redirect handler forces redirecting to the landing-uri on success but I often like to do something with the newly gained access token right away, like fetch user details, (open) id, federating with local user account etc. Would you consider supporting optional custom handlers for each profile, e.g. {:success-handler (fn [access-token] ...)}?

@weavejester
Copy link
Owner

I assume you know that you can just put the success handler on the landing-uri, and that you're suggesting an optimisation?

@kaosko
Copy link
Author

kaosko commented Nov 19, 2017

Well a bit more than on optimization I guess. It's still going to do a redirect and expects a potential function to return a landing-uri. And on error, it just returns 400.

@weavejester
Copy link
Owner

Sure, but you could do all of those things from the landing-uri. The only thing a success handler gives you, as far as I can see, is that you get to perform actions before the redirect.

@kaosko
Copy link
Author

kaosko commented Nov 19, 2017

Or even without a redirect. But yes, of course.

@whamtet
Copy link
Contributor

whamtet commented Mar 7, 2023

#37 partially addresses this issue, but the limitation is that :redirect-handler replaces the default handler when present. I would have thought it made more sense to always apply the default handler and then pass a success / error result to :redirect-handler when it is present. That's because we're always going to need to execute get-access-token.

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

No branches or pull requests

3 participants