API: Google Login?

Hi,

Is there a way to do a Google login via API?

Thanks,
Yaron

Asked by on Oct 19, 2012 - 09:26

on Oct 19, 2012 - 12:12

Hi Yaron

There is! We will write some documentation about it.

Regards,
Amir

on Oct 21, 2012 - 11:13

Hi Yaron

We have now documented this, please check out /API/loginWithGoogle on http://todoist.com/API/help

Let me know if you run into any problems.

Regards,
Amir

on Oct 21, 2012 - 21:27

Thanks! :-)

Yaron

on Mar 23, 2013 - 13:45

Hi, i am trying to use the API but:

I need five parameters to login with Google:

scope, state, redirect_uri, response_type and client_id.

Basically what I should put on client_id?

on Mar 23, 2013 - 14:57

Hello Richard,

In order to make it work when following the OAuth 2.0 flow, you must previously register the application via Google APIs console in Google, as stated here: https://developers.google.com/accounts/docs/OAut


Best regards,
David

on Mar 23, 2013 - 19:08

One more question.

Why when I try:

https://todoist.com/API/loginWithGoogle

And I try to do a HTTP Request (GET) with email and oauth2_token the API returns "LOGIN_ERROR" ?

on Mar 24, 2013 - 06:50

Richard,

It means that oauth2_token is either incorrect or outdated, or issued for the wrong scope.

You can check if the token is correct by performing the HTTP request to Google API by yourself. The query can be performed with just a web-browser, and you should open the URL https://www.googleapis.com/oauth2/v1/userinfo?access_token= . If you get the JSON response with "Login required", it means that access token is invalid.

"Classic" OAuth 2.0 protocol flow is a two-step process. It suggests that client receives authorization code first, and then exchanges this authorization code to the access token. It's wrong to pass authorization code to requests where the access token is expected. Please refer to this chapter of RFC for more information: http://tools.ietf.org/html/rfc6749#section-4.1


Best regards,
David