开发者

{'error':'grant_type'} for Google Contacts API

This is a continuation of my previous post: Google Contacts data API giving 500 Error.

You can get the my code and how I am ca开发者_JAVA百科lling CURL in the above post. Previously, I was getting a 500 Error intermittently, but once I rest my client_secret using Google API console, it was fixed for the time being.

But now, I am getting {error:invalid_grant} all of a sudden when I am requesting for the access token. What might be the reason behind this error?

I searched a few forums where they have said that this error can arise because of sending the POST parameters in the URL itself instead of using them in the POST body. But, to me, it seems that I haven't done anything of that sort in my code.

Also there is no error description along with the error type.

Another thing, I am actually urlencoding all the parameters (e.g client_secret,redirect_uri and even grant_type) , can this be the reason?

I had echoed out the $post variable containing the POST parameters in the log file, and it shows something like the following:

code=4%2Fsb898gAIIsd20FQk69yPvASTwN1s
&client_id=33137499441.apps.googleusercontent.com
&client_secret=<client_secret>
&redirect_uri=http%3A%2F%2Fwww.plus-one-me.com%2Foauth2callback&grant_type=authorization_code

Feel free to suggest any better and convenient way to implement the importing of Gmail contacts.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜