sharing authentication between multiple projects (e.g. widgets)
See original GitHub issueIs your feature request related to a problem? Please describe.
We have multiple projects (typically, widgets on a web page), done by multiple teams. Because of single signout, we typically run a silent-refresh when a page is opened, to get a token if possible (we use authorization code flow, and prompt=none
is typically used to make this non-invasive).
Widgets are not necessarily done in angular and are just separate scripts who don’t know of each other, but they should be able to a) know that authentication is ready (whether a user is actually logged or not), and b) can the token is session storage. c) rely upon the fact that tokens are refreshed on a regular basis
Describe the solution you’d like As widgets with actual features are not really responsible for authentication, and there is no real master which could trigger it anyway, we created a widget with no output whose sole purpose is initiating silent request, and emitting an event when done.
From then on, it emits an event, which can be caught by other widgets.
Other widgets then can use the token from session storage.
The authentication widgets is further using the refresh scope, so tokens are refreshed properly.
Describe alternatives you’ve considered
- Implementing the authentication widget as a script (not angular), but that would have to be done with another library, which might complicate integration in angular widgets.
- Handling authentication in each widget, with safeguards → pain in the ass and copy-pasted boiler-plate.
Additional context The question here is: could we have a feature that would make such feature easy to implement? Or even a part of the library that wouldn’t depend on angular and could be started wherever on a page, firing an event when ready?
Issue Analytics
- State:
- Created 2 years ago
- Comments:11
Top GitHub Comments
I’ll possibly let the use case mature some more, and create a pull request then.
Thanks for your feedback.
To clarify, by using the term “widgets”, I actually mean any independant angular-elements component on the page, or any application / web components combination.