Do you know that a session is being returned? Have you tested the session right after it’s returned? Does the session appear valid?
If you suspect that there is a bug the API, you will need to build a minimum scenario where you show the error. It might be that you are not presenting the session properly. You will need to check out what’s happening in your code by adding console.log() statements allowing you to inspect variables and other information. And keep the scenario very simple.