Google云打印获取访问令牌 [英] Google cloud print get access token

查看:96
本文介绍了Google云打印获取访问令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I want to call /search method of Google cloud print from my webServer.

我正在使用OAuth Web服务器指南获取使用示波器的refresh_token/access_token:

I am using OAuth web server guide obtaining a refresh_token/access_token to use with scopes:

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

然后,我正在调用search Api,但我却获得了403禁止访问.

Then I am calling search Api but I am obtaining a 403 forbidden.

    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

范围正确吗? 我在做什么错了?

Is the scope correct? What am I doing wrong?

推荐答案

您的范围是错误的.正确的范围是https://www.googleapis.com/auth/cloudprint

Your scopes are wrong. The correct scope is https://www.googleapis.com/auth/cloudprint

这篇关于Google云打印获取访问令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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