azureazure-active-directoryhttp-errorfederated-identitynuxt-auth

431 request header fields too large - Nuxt auth with Azure active directory federation


I'm trying to add authentication for the nuxt application through IDP federation with azure AD. basically nuxt auth calls to Azure B2C tenant and it federate to the Azure AD.

The process as follows.

Nuxt Auth -> Azure B2C -> Azure AD (Federated IDP)

Azure AD returns the token as the result of federation.

Azure B2C add that token to the ID token under the key idp_access_token. Then Nuxt auth get the token and use it for authentication.

But after successful login it expect to redirect to the /home page.

redirect: {
      login: "/",
      callback: "/",
      home: "/home"
    }, 

while it redirect it shows the 431 error. The reason for that is large cookie that contains

access token, refresh token

Instead of redirect to the given home page it gives an error like following screenshot shows.

enter image description here

error shows like follows.

enter image description here

is there any way to solve this issue?

I upgraded node version from 12 to 15, deleted browser cache and cookies. But issue is still there.


Solution

  • For 431 error code, we need to change the max size of http request header, use command

    --max-http-header-size
    

    and here's an answer related.