Google云打印获取访问令牌

 zhihong520珠珠_448 发布于 2023-02-13 10:25

我想从我的webServer调用/搜索Google云打印方法.

我正在使用OAuth Web服务器指南获取一个与范围一起使用的refresh_token/access_token:

https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile

然后我打电话给搜索Api,但我获得了403禁止.

    Request DefaultHttpRequest(chunked: false)
    POST /cloudprint/search HTTP/1.1
    Host: www.google.com
    Content-Type: text/plain; charset=utf-8
    Authorization: OAuth yb29.1.AADtN_U9PYyVhGpcS-8MpFhfGVbT4KsZKEoIX2HGePwoNXypjrSwVsS0pGzmaqhktfGBAQ
    Connection: keep-alive
    Accept: */*
    User-Agent: NING/1.0
    Content-Length: 0

    Response DefaultHttpResponse(chunked: true)
    HTTP/1.1 403 Forbidden
    Content-Type: text/html; charset=utf-8
    Cache-Control: no-cache, no-store, max-age=0, must-revalidate
    Pragma: no-cache
    Expires: Fri, 01 Jan 1990 00:00:00 GMT
    Date: Tue, 03 Dec 2013 17:05:09 GMT
    Set-Cookie: NID=67=MQJFdl-YkMdz875n1J2yVNmeUeAvsjVtDGlNvGkNLZdNTHX3YbnStNx9Vg_MiRsmht6hj3XrwJcPJEQeFLlnYKqt2Of1xHJ5HDwNJgOB3svOdnN-JRFcPxYt4AU10eSM;Domain=.google.com;Path=/;Expires=Wed, 04-Jun-2014 17:05:09 GMT;HttpOnly
    P3P: CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info."
    X-Content-Type-Options: nosniff
    X-Frame-Options: SAMEORIGIN
    X-XSS-Protection: 1; mode=block
    Server: GSE
    Alternate-Protocol: 443:quic
    Transfer-Encoding: chunked

范围是否正确?我究竟做错了什么?

1 个回答
  • 你的范围是错误的.正确的范围是https://www.googleapis.com/auth/cloudprint

    2023-02-13 10:28 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有