feat: Add broadcaster to OAuth
Description
This MR is the last part of !240 (closed) which introduces a Broadcaster
that utilizes BroadcastChannel
. This way other Web IDE tabs can be notified if the OAuth token is updated in a separate tab.
Screenshots
- Apply this patch which sets the
tokenLifetime
and applied the logging changes in !257 (closed). 0001-patch-Add-minLogLevel-to-config-and-set-token-time.patch. - Open the example app and start with Authentication Type as
OAuth
(see relevant docs). - Open mutliple tabs of the example app with the same config.
- Wait a few seconds for the token to expire (i.e.
...expiresAt - Date.now()
to be under300000
) then open a file you haven't opened before. In the console log you should seeOAuthClient - starting token refresh...
. The other tabs should not have this log. - Switch to another tab and try to open a file you haven't opened before. The file should open successfully and no
OAuthClient - starting token refresh...
logged since the other tabs received a signal to update their token cache.
Edited by Paul Slaughter