Google 相册 API - 身份验证 [英] Google Photos API - authentication

查看:58
本文介绍了Google 相册 API - 身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 Google 相册获取我的共享相册列表.我在 Google Developers Console 中找到了启用照片 API.

HTTP 获取: 可以帮助您通过较小的设置访问 Google API.

访问令牌也有生命周期,所以如果你不使用图书馆 您需要手动刷新令牌.

I'm trying to get list of my shared albums from Google Photos. I found a enable Photos API in Google Developers Console.

HTTP GET: https://content-photoslibrary.googleapis.com/v1/sharedAlbums?key=AIzaSyCkXXXXXXXXXXXXXZiOSe9IiyM8E

RESULT:

{ "error": { "code": 401, "message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.", "status": "UNAUTHENTICATED" } } 1

Configuration in developers console:

Please, what I'm doing wrong? Thank you.

解决方案

Google API need an access token to make sure that the user has the permission to access the feature. Access token is just like cookie that should be send together with the request.

Usually you will need so many setup to get the access token with your own code. But there are a client library that can help you access Google API with small setup.

Access token also has a lifetime, so if you don't use the library you will need to manually refresh the token.

这篇关于Google 相册 API - 身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆