I am configuring the OAuth-Proxy for use with Trafik to route requests from web browser to Google login. I am struggling with the oauth2_proxy service. I use the latest image.
The Traefik service routed the web requests to the Goole sign-in panel in Oauth2_proxy. But when I clicked the panel, it kept staying there, not routing me to sign-in option. The oauth2_proxy service always shows the cookie issue. I already tried to set cookie_secure
either true
or false
but it didn't work for me.
Here are the logs:
[2021/05/05 05:45:15] [oauthproxy.go:142] OAuthProxy configured for Google Client ID: 309936706134-6mre34kidh10hncvohiu8mvre77171g5.apps.googleusercontent.com
[2021/05/05 05:45:15] [oauthproxy.go:148] Cookie settings: name:_oauth2_proxy secure(https):true httponly:true expiry:168h0m0s domains: path:/ samesite: refresh:after 1h0m0s
[2021/05/05 05:45:15] [http.go:57] HTTP: listening on 0.0.0.0:4180
[2021/05/05 05:45:54] [stored_session.go:75] Error loading cookied session: cookie "_oauth2_proxy" not present, removing session
171.253.133.36 - - [2021/05/05 05:45:54] grafana.ubuntu.mydomain.org GET - "/oauth2/auth" HTTP/1.1 "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36" 401 21 0.000
[2021/05/05 05:45:54] [stored_session.go:75] Error loading cookied session: cookie "_oauth2_proxy" not present, removing session
171.253.133.36 - - [2021/05/05 05:45:54] grafana.ubuntu.mydomain.org GET - "/http://oauth:4180/oauth2/sign_in" HTTP/1.1 "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36" 403 2537 0.000
I tested the image locally and it works for me, with no cookies session issue. Here is the docker command I ran:
docker run -p 4180:4180 quay.io/pusher/oauth2_proxy:v3.1.0 \
--cookie-secure=false \
--upstream="file:///dev/null" \
--http-address="0.0.0.0:4180" \
--redirect-url="https://grafana.ubuntu.example.org" \
--cookie-secret= \
--client-id= \
--client-secret=\
--email-domain=*
Any help would greatly appreciate!!!