使用DriveService.Permission.List()
时,您会获得特定文件的权限列表。但是没有任何内容可以唯一标识具有权限的用户帐户。我发现某个地方可以将https://www.googleapis.com/auth/userinfo.email
添加到范围列表中以实现此目的,但这只是给了我一个不好的请求,否则它会起作用。
有没有办法让用户名参与?我正在使用服务帐户,因为无法将OAuth2与复制粘贴密码一起使用...
我知道可以使用Documents List API完成此操作,但我不想使用已弃用的API。
答案 0 :(得分:1)
您需要对https://www.googleapis.com/auth/userinfo.email
和https://www.googleapis.com/auth/userinfo.email
进行授权,并通过在下方提出请求来请求用户个人资料。
GET https://www.googleapis.com/userinfo/v2/me
您可以尝试使用API Explorer:https://developers.google.com/apis-explorer/#p/oauth2/v2/oauth2.userinfo.v2.me.get