未定义身份验证会话

Cha*_*hao 5 oauth-2.0 google-photos-api

我尝试使用 Google Photos API 上传我的图片,基于以下链接的步骤。

https://developers.google.com/photos/library/guides/upload-media

在遵循为 Web 服务器应用程序使用 OAuth 2.0之后,我只得到 Oauth2.0_token 响应(带有 access_token、refresh_token...的 JSON 格式)。但是,在我将此带有“Bearer”的令牌字符串放入请求标头后,响应为错误 401,错误消息为“未定义代码 16 身份验证会话”。

我找不到任何信息来处理它,感谢您的帮助。

小智 2

您可能拥有不正确的权限。确保您请求具有适当范围的令牌。对于只写访问,您需要“ https://www.googleapis.com/auth/photoslibrary.appendonly

src:https://developers.google.com/photos/library/guides/authentication-authorization#what-scopes