使用Google Cloud Endpoint的简易访问API(开发人员密钥)(Python) [英] Simple Access API (Developer Key) with Google Cloud Endpoint (Python)

查看:126
本文介绍了使用Google Cloud Endpoint的简易访问API(开发人员密钥)(Python)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法使用Simple Access API(开发人员密钥)而不是oAuth2密钥与Google Cloud Endpoint?

您的 protorpc 请求对象中不在定义范围内的额外字段仍然与请求一起存储。



如果您想使用字段作为查询参数,您可以通过

  request.get_unrecognized_field_info('key')

即使 key 不是您消息定义中的字段。



这是在users_id_token.py端点库的Auth部分)允许发送 bearer_token access_token 作为查询参数而不是标题值。



不幸的是,配额检查和简单API访问密钥给出的其他相关部分不容易获得。但是,您可以发行自己的密钥并根据列表手动检查密钥,并可能检查您已定义的配额。


Is there a way to use Simple Access API (Developer Key) instead of oAuth2 key with Google Cloud Endpoint?

解决方案

Extra fields in your protorpc request object that aren't part of the definition are still stored with the request.

If you wanted to use a key field as a query parameter, you could access it via

request.get_unrecognized_field_info('key')

even if key is not a field in your message definition.

This is done in users_id_token.py (the Auth part of the endpoints library) to allow sending bearer_token or access_token as query parameters instead of as header values.

Unfortunately, the nice quota checking and other associated pieces that a "Simple API Access" key gives are not readily available. However, you could issue your own keys and manually check a key against your list and potentially check against quotas that you have defined.

这篇关于使用Google Cloud Endpoint的简易访问API(开发人员密钥)(Python)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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