我使用https://developers.google.com/admin-sdk/directory/v1/reference/users/insert在我的域名上创建新用户。
之后,我想立即更改其日历设置。当我尝试模仿用户时,我收到以下错误:
Signet::AuthorizationError: Authorization failed. Server message:
{
"error": "unauthorized_client",
"error_description": "Client is unauthorized to retrieve access tokens using this method."
}
如果我等待20秒,我不会收到此错误。如何立即模拟新创建的用户?
答案 0 :(得分:1)
你基本上回答了自己的问题。您有时需要等待一段时间才能使用新创建的实体。我在an example的google-api-dotnet-client issue看到了这个问题,你告诉程序本身等一下:
Console.WriteLine("OrgUnit inserted: {0}\r\n", insertedOrgUnit.OrgUnitPath);
// That should've worked okay.
Console.WriteLine("Pausing for ten seconds because sometimes you can't retrieve something immediately after you've created it...\r\n");
System.Threading.Thread.Sleep(10000);