I am following https://www.scottbrady91.com/Angular/SPA-Authentiction-using-OpenID-Connect-Angular-CLI-and-oidc-client and https://www.scottbrady91.com/Angular/Migrating-oidc-c
As you already find out the exact problem is of header limit and solve it by limiting cookie size but limiting cookie size may not be a solution everytime.Main reason behind why angular doesn't accept large header data is bcs angular use node serve webpack-dev-server
and there is limit on header size in node js you can find related issue bellow
ng serve fails to serve pages when large cookies are present
400 Bad request due to Node limiting header size to 8kB
Update npm run to fix hpe_header_overflow in recent nodejs versions
Make HTTP_MAX_HEADER_SIZE configurable
So instead of using ng serve
using command
node --max-http-header-size=16385 ./node_modules/@angular/cli/bin/ng serve
should be the solution to your problem