Problem:

In a Data Center instance, users cannot log in using SSO and they are getting the following error message:

'Could not find a userid for token XXX'


Explanation / Solution:

This issue happens when the session stickiness is not configured in the load balancer.

Data Center applications assume that each user's request will go to the same node during a session. If requests go to different nodes, users may be unexpectedly logged out and may lose information stored in their session. Therefore, it is required to bind a session to the same node by enabling cookie-based "sticky sessions" (or session affinity) on the load balancer. When using cookie-based sticky sessions, you can use the cookie issued by the Atlassian application, or you can use a cookie generated by the load balancer.

When a user first starts the login process, they start in one of the nodes. Then after the authentication happens on the IdP side, they get redirected to another node for the authorization into the Atlassian product. Thus, they cannot log into the system, since the token was created on the first node.

Please check the following Atlassian article for more information about Data Center Load Balancer examples: https://confluence.atlassian.com/enterprise/jira-data-center-load-balancer-examples-781200827.html