Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Support]: How to Implement OAuth2 Proxy with React App and Node.js Backend Without Losing Headers #2860

Open
Idan-Lazar opened this issue Nov 19, 2024 · 1 comment

Comments

@Idan-Lazar
Copy link

OAuth2-Proxy Version

latest

Provider

azure

Current Behaviour of your Problem

I am using OAuth2 Proxy with Microsoft Azure AD as the identity provider. After successfully logging in, the expected headers (e.g., Authorization or X-Forwarded-*) are not being forwarded from my React App (my upstream) to my backend service. This is causing issues where the backend cannot authenticate requests or retrieve user information.
If there’s an official tutorial or guide for configuring OAuth2 Proxy with Microsoft Azure AD in this scenario, it would be greatly appreciated.

Configuration details or additional information

provider = "azure"
client_id = ""
client_secret = "
"
cookie_secret = "***"

OIDC Issuer URL

oidc_issuer_url = "https://login.microsoftonline.com/***/v2.0"
redirect_url = "http://localhost:4180/oauth2/callback"

Allow all email domains for authentication

email_domains = ["*"]

Enable passing tokens and Authorization headers to upstream servers

pass_access_token = true
pass_authorization_header = true

Cookie settings

cookie_refresh = "1h"
cookie_name = "oauth2-proxy"
cookie_secure = false

Local address and port to bind OAuth2 Proxy

http_address = "0.0.0.0:4180"

Upstream application (react app)

upstreams = ["http://172.20.10.5:3000/"]
reverse_proxy="true"

Extra options for Azure provider

scope = "openid profile email https://graph.microsoft.com/.default"

Steps To Reproduce

No response

@jjlakis
Copy link
Contributor

jjlakis commented Jan 6, 2025

Try adding:

  • set_authorization_header=true - this passes Authorization header
  • set_xauthrequest=true - this passes X-Auth-Request-Access-Token, X-Auth-Request-Email, X-Auth-Request-Groups ,X-Auth-Request-User, ... headers

Let me know if that works for you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants