dermesser / yup-oauth2

An oauth2 client implementation providing the Device, Installed, Service Account, and several more flows.
https://docs.rs/yup-oauth2/
Apache License 2.0
219 stars 114 forks source link

Allow setting custom redirect URL #194

Closed k-bx closed 1 year ago

k-bx commented 1 year ago

Resolves https://github.com/dermesser/yup-oauth2/issues/191

dermesser commented 1 year ago

I think the pub(crate) on the flow_delegate field is what caused the misunderstanding - I totally missed it. Sorry about that and thanks for the PR!

k-bx commented 1 year ago

No problem. Feel free to dismiss this PR and reimplement more properly if needed.

dermesser commented 1 year ago

By the way, have you also tried the documented way of https://docs.rs/yup-oauth2/latest/yup_oauth2/struct.InstalledFlowAuthenticator.html: InstalledFlowAuthenticator::builder(..).flow_delegate(..).build(..)? It's been some time since I worked on that code, so it didn't come to mind immediately, either.

k-bx commented 1 year ago

@dermesser is it not shown at the link since it's not pub(crate) too?

dermesser commented 1 year ago

@dermesser is it not shown at the link since it's not pub(crate) too?

Sorry, wrong link. I meant https://docs.rs/yup-oauth2/latest/yup_oauth2/authenticator/struct.AuthenticatorBuilder.html#method.flow_delegate-1 and supplying your own flow delegate, which gives you the opportunity of both specifying the redirect_uri and capturing the code.

What got me confused, I think, is that what you were trying to do is how things used to be done. Then it was refactored into the current "Java-Style", which made some things non-obvious.

k-bx commented 1 year ago

@dermesser you are right, this API worked!

image

Thank you for the hint.

dermesser commented 1 year ago

No worries, and sorry for taking so many detours :D