3

我在 Chrome 扩展程序中使用身份 API来验证用户身份并向我的后端证明他们是谁。这在大多数情况下都可以正常工作,我使用getAuthToken来获取我发送到服务器的 OAuth 访问令牌,它使用它来确认用户的身份。

唯一的问题是:第一次调用 getAuthToken 时,会要求用户从他们当前登录的帐户列表中选择一个 Google 帐户。此后对 getAuthToken 的任何调用都只是继续重复使用同一个 Google 帐户而不提示用户。我想让用户以后能够选择不同的 Google 帐户。Seems like clearAllCachedAuthTokens would be exactly what I need - and it works - but only when the chosen Google account isn't the account that's logged into Chrome. 在这种情况下, clearAllCachedAuthTokens 不会做任何事情。

我发现重置锁定的 getAuthToken 的 Google 帐户的唯一方法是让用户退出 Chrome,这既烦人又尴尬。有没有更好的办法?

4

0 回答 0