This question comes in from a reader.

Hi Jeffry, i read your articles at www.medium.com and like it a lot. Especially the article about "Combining Multiple Angular Applications into a Single One" .

So i got a question: Have you ever shared a jwt token between multiple angular applications? So that one login is enough. Like the setup you wrote in your article. Is this possible at all ? It would be nice to hearing from you :) Best regards Georg

Hi Georg,

Thanks for reading my articles from the Disney Streaming Services blog. I'm glad it helped you.

First, for the blog readers I wanted to explain what a JWT is. It is a Java Web Token, or rather some string that can be used to uniquely identify a user. In my work on one project, our JWT values are user objects, transformed to JSON, which are then encrypted and encoded for transport between the browser and server. Each respective request will need to decrypt and decode it to access the data.

Since you are building Angular applications, I assume you are storing the JWT value as a cookie. That's what I often do too.

If you have multiple applications--Angular or otherwise--delivered from the same web domain; they should all have access to that same cookie value and it should be sent to the server as part of every request you make, including REST service calls that most Angular applications use. Once that domain cookie is set, all your applications should be able to access it.

However, If your applications are on different web domains, you can probably create some server side code to generate the same token and send it to both applications based on the user login information. This would be an unusual setup, but I suspect is possible.

Good luck!