2012-10-11 35 views
6

sử dụng sân chơi OAuth2 google: https://developers.google.com/oauthplayground/ Tiếp theo: https://developers.google.com/accounts/docs/OAuth2WebServer#offlineOAuth2.0 yêu cầu không hợp lệ khi cố gắng sử dụng refresh thẻ

Bất cứ ai tại sao tôi nhận được yêu cầu không hợp lệ?

POST /o/oauth2/token HTTP/1.1 
Host: accounts.google.com 
Content-length: 209 
Content-type: application/x-www-form-urlencoded 
Authorization: OAuth ya29.XXXXXXXX 

client_id=XXXXXXXXX& 
client_secret=XXXXXXXXX& 
refresh_token=1/0ffkj5lggn8XXXXXXXXX& 
grant_type=refresh_token 

HTTP/1.1 400 Bad Request 
Content-length: 33 
X-xss-protection: 1; mode=block 
X-content-type-options: nosniff 
X-google-cache-control: remote-fetch 
-content-encoding: gzip 
Server: GSE 
Reason: Bad Request 
Via: HTTP/1.1 GWA 
Pragma: no-cache 
Cache-control: no-cache, no-store, max-age=0, must-revalidate 
Date: Thu, 11 Oct 2012 21:29:55 GMT 
X-frame-options: SAMEORIGIN 
Content-type: application/json 
Expires: Fri, 01 Jan 1990 00:00:00 GMT 

{ 
    "error" : "invalid_request" 
} 

Trả lời

1

Nếu bạn nhận được 400 là do bạn thêm thông số không hợp lệ hoặc bị thiếu.

chỉnh sửa:

tôi tin từ dữ liệu đã cho có thêm tiêu đề Cấp quyền. Điều này chỉ được sử dụng trong oauth2 khi access_token được truyền trong tiêu đề, để thực hiện cuộc gọi được xác thực

Authorization : Bearer XXXXXXXXXXXXXXXX 

trong khi access_token mới không cần phải cung cấp cùng một tiêu đề.

https://developers.google.com/accounts/docs/OAuth2InstalledApp#refresh

+0

Cụ thể hơn .... – DontVoteMeDown

Các vấn đề liên quan