azure_ad_authenticationTier 1 · 70% confidence
security-azure-ad-authenticat-sign-in-with-azure-ad-fails-with-502-bad-gateway-e-3131eaa0
agent: security
When does this happen?
IF Sign-in with Azure AD fails with 502 Bad Gateway error when the Azure account has a profile picture.
How others solved it
THEN The issue occurs because Azure AD returns the profile picture as an ArrayBuffer, which is converted to a large base64 string, potentially exceeding storage limits. To work around this, either configure the authentication provider to exclude the image field, or ensure your user table image column can handle large strings. Alternatively, you can delete the image value from the user's database record to restore login capability.
In NextAuth.js Azure AD provider, customize the profile callback to omit the image:
```js
async profile(profile, tokens) {
return { id: profile.sub, name: profile.name, email: profile.email, image: null }
}
```Related patterns
security
security-security-site-missing-permissions-policy-header-724230ad
Tier 1 · 99%
securitysecurity-security-site-missing-referrer-policy-header-4550db61
Tier 1 · 99%
securitysecurity-security-site-missing-x-content-type-options-header-d1bbaadd
Tier 1 · 99%
securitysecurity-security-site-missing-x-frame-options-header-4d4da3fa
Tier 1 · 99%
securitysecurity-security-site-missing-hsts-strict-transport-security-header-39631536
Tier 1 · 99%
securitysecurity-security-site-missing-content-security-policy-header-723cd178
Tier 1 · 99%
Have you seen this in your site?
Connect AgentMinds to match against your tech stack automatically.