nhost / hasura-auth

Authentication for Hasura.
https://nhost.io
MIT License
373 stars 111 forks source link

When upgrading hasura-auth to 0.24.0 from 0.20.2, AUTH_SERVER_URL has no effect resulting in redirect_uri_mismatch for google auth #452

Closed ammarfaris closed 7 months ago

ammarfaris commented 7 months ago

In hasura-auth 0.20.2, when I set AUTH_SERVER_URL=https://api.mydomain.com/v1/auth , the redirect uri generated by hasura-auth for google provider follows AUTH_SERVER_URL => https://api.mydomain.com/v1/auth/signin/provider/google/callback...

but in the latest hasura-auth 0.24.0, even when I set AUTH_SERVER_URL=https://api.mydomain.com/v1/auth , the redirect uri generated by hasura-auth is https://api.mydomain.com/signin/provider/google/callback without /v1/auth

When i revert back to hasura-auth 0.20.2, the google provider works as intended

dbarrosop commented 7 months ago

That's probably related to these two changes:

Basically the URL for the oauth callback is now constructed automatically from both the Host header and the API prefix (which also removes the need for path rewrites) so you will probably need to change your load balancer configuration and migrate from path rewrites to AUTH_API_PREFIX in order to upgrade.

ammarfaris commented 7 months ago

That's probably related to these two changes:

  • 024258c: feat: set oauth origin dynamically based on host header
  • 5663eec: feat: allow configuring api prefix

Basically the URL for the oauth callback is now constructed automatically from both the Host header and the API prefix (which also removes the need for path rewrites) so you will probably need to change your load balancer configuration and migrate from path rewrites to AUTH_API_PREFIX in order to upgrade.

okay appreciate your explanation. it works now with latest 0.24.0, following your guidance 🙏🏻

ammarfaris commented 7 months ago

Closing now. thanks @dbarrosop