Google auth issue redirect_uri_mismatch
Hi. New question about configuration, maybe somebody has experience and know what I should change it. I have tried to implement Google authorisation. I have created Google credentials keys and successfully added using Django admin page. I use UWSGI proxy for apache setup like "ProxyPass / http://127.0.0.1:8002", UWSGI runs on 0.0.0.0:8002. (So Appache from external address redirects to internal) What happens when I try Google auth... If I set Authorised redirect URIs: http://lists.example.com/accounts/google/login/callback/ , Google gives me error 400 Error: redirect_uri_mismatch and requests for: http://127.0.0.1:8002/accounts/google/login/callback/ If I set that requested address to Google, then Google authorises me, but and after authorisation redirects to http://127.0.0.1:8002/accounts/google....../.... (very long line) Of course this internal address does not open, but... If I just manually replace part of address just: http://127.0.0.1:8002 replace to https://lists.example.com/.../...(long line) this makes me get in as authorised user to the page. How to make django to send external request to Google? Because Google should not point back to internal address... This seems simple, but I do not find what I should change in the configuration: Apache or Django or uwsgi.ini I hope anybody of You have experience and made it to run.
Kind regards Ugnius
On Sun, Sep 8, 2019, at 2:12 PM, Ugnius S wrote:
Hi. New question about configuration, maybe somebody has experience and know what I should change it. I have tried to implement Google authorisation. I have created Google credentials keys and successfully added using Django admin page. I use UWSGI proxy for apache setup like "ProxyPass / http://127.0.0.1:8002", UWSGI runs on 0.0.0.0:8002. (So Appache from external address redirects to internal) What happens when I try Google auth... If I set Authorised redirect URIs: http://lists.example.com/accounts/google/login/callback/ , Google gives me error 400 Error: redirect_uri_mismatch and requests for: http://127.0.0.1:8002/accounts/google/login/callback/ If I set that requested address to Google, then Google authorises me, but and after authorisation redirects to http://127.0.0.1:8002/accounts/google....../.... (very long line) Of course this internal address does not open, but... If I just manually replace part of address just: http://127.0.0.1:8002 replace to https://lists.example.com/.../...(long line) this makes me get in as authorised user to the page. How to make django to send external request to Google? Because Google should not point back to internal address... This seems simple, but I do not find what I should change in the configuration: Apache or Django or uwsgi.ini I hope anybody of You have experience and made it to run.
You need to set this in nginx under your location directive, where you setup your proxy_pass or uwsgi_pass
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
Something similar should exist for Apache.
Kind regards Ugnius
Mailman-users mailing list -- mailman-users@mailman3.org To unsubscribe send an email to mailman-users-leave@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
-- thanks, Abhilash Raj (maxking)
Thank You for the showing good road. Resolved! For Apache2 setup should look:
ProxyPassMatch ^/static/ !
ProxyPass / http://127.0.0.1:8002/
ProxyPassReverse / http://127.0.0.1:8002/
ProxyPreserveHost On
Kind regards Ugnius
2019-09-09, pr, 03:29 Abhilash Raj <maxking@asynchronous.in> rašė:
On Sun, Sep 8, 2019, at 2:12 PM, Ugnius S wrote:
Hi. New question about configuration, maybe somebody has experience and know what I should change it. I have tried to implement Google authorisation. I have created Google credentials keys and successfully added using Django admin page. I use UWSGI proxy for apache setup like "ProxyPass / http://127.0.0.1:8002", UWSGI runs on 0.0.0.0:8002. (So Appache from external address redirects to internal) What happens when I try Google auth... If I set Authorised redirect URIs: http://lists.example.com/accounts/google/login/callback/ , Google gives me error 400 Error: redirect_uri_mismatch and requests for: http://127.0.0.1:8002/accounts/google/login/callback/ If I set that requested address to Google, then Google authorises me, but and after authorisation redirects to http://127.0.0.1:8002/accounts/google....../.... (very long line) Of course this internal address does not open, but... If I just manually replace part of address just: http://127.0.0.1:8002 replace to https://lists.example.com/.../...(long line) this makes me get in as authorised user to the page. How to make django to send external request to Google? Because Google should not point back to internal address... This seems simple, but I do not find what I should change in the configuration: Apache or Django or uwsgi.ini I hope anybody of You have experience and made it to run.
You need to set this in nginx under your location directive, where you setup your proxy_pass or uwsgi_pass
proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr;
Something similar should exist for Apache.
Kind regards Ugnius
Mailman-users mailing list -- mailman-users@mailman3.org To unsubscribe send an email to mailman-users-leave@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
-- thanks, Abhilash Raj (maxking)
participants (2)
-
Abhilash Raj
-
Ugnius S