I have enabled Cognito auth on my ALB. I log in via my dns entry sample.my-domain.com I'm using a SAML IDP in Cognito (Google workspace) and it takes me through he auth flow and I sign in via my google account but I'm presented with a 401 Authorization Required. If I then enter the exact same url sample.my-domain.com, I am successfully taken to my site. I can see the access token in my headers and the correct cookies set by the ALB. I can then browse the site correctly, leave, come back and everything works. If I log out and back in, I get the same initial 401, So it only happens at login, after that everything is fine. I enabled logging on the ALB and I'm getting an AuthInvalidStateParam error on the first call. I can see that call is is GET https://sample.my-domain.com:443/oauth2/idpresponse?code=<REDACTED>&state=<REDACTED>
When I'm pretend the 401 page I see a AWSALBAuthNonce cookie, but no load balancer cookie. When I enter the site url again, I see the AWSALBAuthNonce and the ALB cookies.
Thanks for the help