开发者

Http Post Request

开发者 https://www.devze.com 2023-03-08 03:40 出处:网络
I am trying to authenticate against google, and this is their example request: POST /accounts/o8/oauth2/token HTTP/1.1

I am trying to authenticate against google, and this is their example request:

POST /accounts/o8/oauth2/token HTTP/1.1
Host: www.google.com
Content-Type: application/x-www-form-urlencoded

client_id=21302922996.apps.googleusercontent.com&
client_secret=XTHhXh1SlUNgvyWGwDk1EjXB&
code=4/P7q7W91a-oMsCeLvIaQm6bTrgtp6&
redirect_uri=urn:ietf:wg:oauth:2.0:oob&
grant_type=authorization_code

Should all the lines after content type be headers, or the body of the request? If they are headers, does a blank body suffice?

The address they say to post to is: https://accounts.google.com/o/oauth2/token This differs from the first line of the request. Which is开发者_StackOverflow中文版 correct?

Thanks for any help, Venatu


The error was with the mime type of the message, the default type was causing the request to be ignored. The default request above worked perfectly once the mime type was changed, with the above as the body of the message, using the second address given.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号