【发布时间】:2021-06-03 23:10:42
【问题描述】:
在什么情况下(除了某人撤销更改其 gmail 密码的权限)用户需要重新授权应用程序访问其 gmail 数据?我的应用程序存储并使用刷新令牌来维护当前的访问令牌,但我的用户偶尔仍会被要求从头开始授权,有时这会失败,只有在他们重置浏览器设置后才能再次工作。
【问题讨论】:
标签: oauth google-oauth gmail-api
在什么情况下(除了某人撤销更改其 gmail 密码的权限)用户需要重新授权应用程序访问其 gmail 数据?我的应用程序存储并使用刷新令牌来维护当前的访问令牌,但我的用户偶尔仍会被要求从头开始授权,有时这会失败,只有在他们重置浏览器设置后才能再次工作。
【问题讨论】:
标签: oauth google-oauth gmail-api
刷新令牌过期的原因。
除非您考虑到 2015 年秋季的错误,该错误导致一堆刷新令牌由于夏令时而过期,否则应该是这样。 (那是有趣的一天)
【讨论】:
I'm not storing anything explicitly, it's all being done by Google's Authorization Broker. Here's the code:
UserCredential credential;
using (FileStream credentialsfile = new FileStream(Application.StartupPath + @"/credentials.json", FileMode.Open, FileAccess.Read))
{
string credPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
credPath = Path.Combine(credPath, ".credentials/SJGmailAPI.json");
credential = GoogleWebAuthorizationBroker.AuthorizeAsync(GoogleClientSecrets.Load(credentialsfile).Secrets, Scopes, senderemailaddress, CancellationToken.None, new FileDataStore(credPath, true)).Result;
}
bool rc = AuthTest.TestAuthorisation(credential,senderemailaddress,ApplicationName);
So is Google's own code storing the wrong refresh token then?
【讨论】: