OAuth, API Console and Google Contacts issues

126 views
Skip to first unread message

Sérgio Silva

unread,
Oct 31, 2013, 9:32:57 AM10/31/13
to google-a...@googlegroups.com
My app is using Google Contacts API to access user contacts.
I'm using the gdata library to access it and OpenID+OAuth1 to login and request authorisation. 
Google recently made some changes and now states:

Warning: Due to enhanced security measures we've added to our infrastructure, all developers using the Contacts API must register their projects in the API Console and ensure the Contacts API is activated in the API Console.

If your application has certain unusual authorization requirements, such as logging in at the same time as requesting data access (hybrid) or domain-wide delegation of authority (2LO), then you cannot currently use OAuth 2.0 tokens.
In such cases, you must instead use OAuth 1.0 tokens and an API key. You can find your application's API key in the GoogleAPI Console, in the Simple API Access section of the API Access pane.

So here starts my problems:
 1 - My Google Cloud Console lists the AppEngine App project. however I can't add an API project to it. I can create a new API project but I can't seem to link it to the existing App. I'd like that the API usage and billing all be combined on the same project as the app engine app.

 2 - Creating a Google Cloud Integration from the AppEngine console yields:
Create a Google Cloud project for this application. An error occurred when creating the project. Please retry.

Pressing retry does not fix it.

3  - I also tried creating an independent API project and adding a 'key=xxxxxxxx' to the urls generated by the gData client library with the App Key but I get always as response 401 Client error. It seems not to be working with OAuth1 AND App Key

4 - Can anyone tell me if migrating to OAuth2.0 it is possible to do login+request auth in the same step? Anyone migrated from Oauth1? What's the best strategy? 

Thanks!



Vinny P

unread,
Oct 31, 2013, 11:51:36 AM10/31/13
to google-a...@googlegroups.com
On Thu, Oct 31, 2013 at 8:32 AM, Sérgio Silva <sergio...@gmail.com> wrote:
So here starts my problems:
 1 - My Google Cloud Console lists the AppEngine App project. however I can't add an API project to it. I can create a new API project but I can't seem to link it to the existing App. I'd like that the API usage and billing all be combined on the same project as the app engine app.


What you can do is create a new API Project, then use the authentication keys it generates on a different project as a short-term bandaid fix (leave the API project and the GAE project unlinked). To get the API usage and GAE billing on the same project requires that you first integrate your GAE application into a Google Cloud project (there's a button for that in the Application Settings page in the GAE console).  


On Thu, Oct 31, 2013 at 8:32 AM, Sérgio Silva <sergio...@gmail.com> wrote:
 2 - Creating a Google Cloud Integration from the AppEngine console yields:
Create a Google Cloud project for this application. An error occurred when creating the project. Please retry.
Pressing retry does not fix it.


How many times have you pressed retry and over what period? If you've only started recently, try integrating again tomorrow or over the weekend. It should succeed sooner or later. Alternatively you can file an issue in the tracker. I see you've already commented on Issue 9602 ( https://code.google.com/p/googleappengine/issues/detail?id=9602 ), but that's listed as a Fixed issue - you should open a new issue if you are still having difficulties.


On Thu, Oct 31, 2013 at 8:32 AM, Sérgio Silva <sergio...@gmail.com> wrote:
3  - I also tried creating an independent API project and adding a 'key=xxxxxxxx' to the urls generated by the gData client library with the App Key but I get always as response 401 Client error. It seems not to be working with OAuth1 AND App Key


You should be moving to OAuth 2.0. In addition, you shouldn't need to be editing the URLs the client library generates - they should be valid unless you're passing in incorrect authentication data.

Are you editing the URLs and letting the library go to those URLs, or are you taking the edited URLs and accessing them outside the library?



On Thu, Oct 31, 2013 at 8:32 AM, Sérgio Silva <sergio...@gmail.com> wrote:
4 - Can anyone tell me if migrating to OAuth2.0 it is possible to do login+request auth in the same step? Anyone migrated from Oauth1? What's the best strategy? 



Which authentication flow are you using? By flow, I mean the options on this page: https://developers.google.com/accounts/docs/OAuth2 

 
 
-----------------
-Vinny P
Technology & Media Advisor
Chicago, IL

App Engine Code Samples: http://www.learntogoogleit.com
 

Sérgio Silva

unread,
Oct 31, 2013, 12:16:11 PM10/31/13
to google-a...@googlegroups.com
Hi Vinny!
Thanks for your help.

Inline


On Thursday, October 31, 2013 3:51:36 PM UTC, Vinny P wrote:
On Thu, Oct 31, 2013 at 8:32 AM, Sérgio Silva <sergio...@gmail.com> wrote:
So here starts my problems:
 1 - My Google Cloud Console lists the AppEngine App project. however I can't add an API project to it. I can create a new API project but I can't seem to link it to the existing App. I'd like that the API usage and billing all be combined on the same project as the app engine app.


What you can do is create a new API Project, then use the authentication keys it generates on a different project as a short-term bandaid fix (leave the API project and the GAE project unlinked). To get the API usage and GAE billing on the same project requires that you first integrate your GAE application into a Google Cloud project (there's a button for that in the Application Settings page in the GAE console)


I can do this for testing, ideally I'd like to have to API project integrated to manage it all from the same place.

 


On Thu, Oct 31, 2013 at 8:32 AM, Sérgio Silva <sergio...@gmail.com> wrote:
 2 - Creating a Google Cloud Integration from the AppEngine console yields:
Create a Google Cloud project for this application. An error occurred when creating the project. Please retry.
Pressing retry does not fix it.


How many times have you pressed retry and over what period? If you've only started recently, try integrating again tomorrow or over the weekend. It should succeed sooner or later. Alternatively you can file an issue in the tracker. I see you've already commented on Issue 9602 ( https://code.google.com/p/googleappengine/issues/detail?id=9602 ), but that's listed as a Fixed issue - you should open a new issue if you are still having difficulties.


Over 2 days. I know the issue is marked as closed, but I'm hopping the comment still triggers emails to the owners. I'll try again over the weekend and open a new issue if it still persists.
 

On Thu, Oct 31, 2013 at 8:32 AM, Sérgio Silva <sergio...@gmail.com> wrote:
3  - I also tried creating an independent API project and adding a 'key=xxxxxxxx' to the urls generated by the gData client library with the App Key but I get always as response 401 Client error. It seems not to be working with OAuth1 AND App Key


You should be moving to OAuth 2.0. In addition, you shouldn't need to be editing the URLs the client library generates - they should be valid unless you're passing in incorrect authentication data.

Are you editing the URLs and letting the library go to those URLs, or are you taking the edited URLs and accessing them outside the library?

 
Actually I'm not editing the URL directly

query = gdata.contacts.service.ContactsQuery(params={'key':'MY_API_KEY'})
query
.max_results = 200
feed
= googleintegration.contacts_service.GetContactsFeed(query.ToUri())



 

On Thu, Oct 31, 2013 at 8:32 AM, Sérgio Silva <sergio...@gmail.com> wrote:
4 - Can anyone tell me if migrating to OAuth2.0 it is possible to do login+request auth in the same step? Anyone migrated from Oauth1? What's the best strategy? 



Which authentication flow are you using? By flow, I mean the options on this page: https://developers.google.com/accounts/docs/OAuth2 



OpenID+OAuth Hybrid protocol lets web developers combine an OpenID request with an OAuth authentication request. This extension is useful for web developers who use both OpenID and OAuth, particularly in that it simplifies the process for users by requesting their approval once instead of twice.

Now I need to find out if the OpenID providers I currently support also support Oauth2Login...

Vinny P

unread,
Oct 31, 2013, 8:32:20 PM10/31/13
to google-a...@googlegroups.com
Regarding the 401 Client error, that usually indicates that the request is incorrectly formatted (the wrong URL, improper access information). Unfortunately, there are so many variables at play (authentication, permissions, etc) that it's difficult to pin down an exact cause. Try using the OAuth Playground ( https://developers.google.com/oauthplayground/ ) and verify that your access credentials correctly access the Contacts service. 

Regarding OpenID and OAuth, you might want to look at https://developers.google.com/api-client-library/python/guide/aaa_oauth - it contains a presentation on using OAuth and Google APIs.
Reply all
Reply to author
Forward
0 new messages