Title: Angular and session with a cookie + oauth
Tags: angular;session;oauth;oauth-2.0;openid
Question: I have a front-end built with angular.io and a back-end handling authorization with open id and the authorization code flow.
So when a user wants to have access to the back-end.
I need to redirect him to the login page of my identity provider
Then he needs to be redirected back to the front-end
By default my back-end will hold tokens in memory and offer a session id cookie to the front-end
Each request to the back-end shall contain the cookie holding the session id
And probably I need to ask silently for a new session id cookie when it expires.
Googling a bit, I could not find an angular module to achieve this "out of the box". Am I wrong or I need to implement this myself?
Thanks
Comment: I'm not sure you need to save the token on the server. Usually, you provide the client with a token and the client use this token to authenticate itself to the backend. The backend validate that the token is still active, and decode it to get access to the user id.

Comment: Well I am not doing it like intentionally. This is the default behaviour with spring and oauth. The idea is maybe that by default, to have an API Gateway. I am not sure. But I do not want to change the default behaviour, and I would like to go on with cookies.



{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 0, 'CommentCount': 2, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2020:00:04/28/20', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<angular><session><oauth><oauth-2.0><openid>', 'Title': 'Angular and session with a cookie + oauth', 'ViewCount': 111, 'id': 61480599, 'user_AboutMe': None, 'user_AccountId': 18357946.0, 'user_DisplayName': 'Tralala', 'user_Reputation': 1.0, 'user_Views': 3.0, 'user_id': 13370608.0}}