honojs / middleware

monorepo for Hono third-party middleware/helpers/wrappers
https://hono.dev
421 stars 145 forks source link

Custom redirect uri for @hono/oauth-providers/google #591

Open amit-saxena opened 3 months ago

amit-saxena commented 3 months ago

I am using @hono/oauth-providers/google, behind a reverse proxy and could not set custom redirect uri. Since, Open Auth handles the redirect uri internally.

aaronware commented 3 months ago

@amit-saxena you can accomplish this by passing your own redirect_to in the "state" object. The state will be returned to you as query parameters and from there you can do with it whatever you need. In my scenario I am using Oauth in a WordPress plugin and didn't want to register every domain where the plugin was interacting with my API. See my pull request https://github.com/honojs/middleware/pull/454 that was merged in order to accomplish this.

I see this was a few weeks ago so hopefully you weren't stuck

amit-saxena commented 3 months ago

Thank you @aaronware this is useful.