Open gmail.com
switch to secondary accuont in gmail
install a Gmail as PWA on desktop as a seperate window
make sure the PWA has secondaary account opened in PWA window
Quit the PWA and open it again
Obeserve that
the primary account is opened in PWA always no matter how many times you quit and reopen
also you cant switch the account in PWA to secondary account
if you try to switch to the secondary account then it is opened in browser and not in PWA
The PWA URL always points to primary account
The the url should point to secondary account
To solve this problem please follow the steps below
Run the following script in browser before installing PWA.
Change the startUrl
to appropriate google app viz chat/gmail/calendar and the index to proper account
const startUrl = 'https://mail.google.com/chat/u/1/#chat/home';
const unsanitizedHtmlPolicy = trustedTypes.createPolicy('unsanitizedHtml', {
createHTML: (htmlString) => htmlString,
});
document.head
.querySelector(':first-child')
.insertAdjacentHTML(
'beforebegin',
unsanitizedHtmlPolicy.createHTML(
`<link rel="manifest" href='data:application/manifest+json,{"start_url":"${startUrl}"}' />`,
),
);
Now install it as PWA.
Quit and start the PWA again to verify that the PWA points to correct account.