I am trying to build a scenario where a front-end application (application A) calls REST APIs of another application (application B) to authenticate a user. Application B generates a tokenId for the user and sends it back in the REST API response once the user is authenticated
Application A now wants to utilize this tokenId to also establish a browser session of the same user with application B, so that later it should be able to redirect the user to application B as and when required (without prompting for username and password again because user is already authenticated over REST)
Application B expects the tokenId to be part of a header in order to identify the authenticated user and trust it is authenticated.
Now there are two questions:
- Is it possible to do above technically? If yes, how can we pass the tokenID from response body of REST API to browser at the time of redirection to establish session (I am thinking of something like creating a hidden form and doing a POST but not sure how tokenId can be included in the header with this setup)
- Is there any security concern in this type of setup/flow?
Kindly need guidance on above, suggestions and ideas are also welcome!