Re: [google-appengine] App Engine to Calendar Authentication

2013-06-08 Thread Google Tasks Backup Moderator
Hi James,

As pointed out by someone else earlier, the redirect URI needs to be https.

Also, if you are using Python, I've found the easiest method to implement
Oauth2 is to use the Oauth2Decorator supplied by Google.
See
https://developers.google.com/api-client-library/python/guide/google_app_engine#Decorators

It makes using Oauth a breeze! The example about halfway down the page
shows just how neat and simple it is. When I switched to using the
decorator, it saved me at least a page of code, and is more reliable and
results in neater code too.

Cheers,

Julie

On 6 June 2013 17:29, James Gralton james.gral...@ocado.com wrote:

 Hi,


 I am new to App Engine and am trying to write an application which will
 access Google Calendar to get details of any events for the current time. I
 am struggling to see how the authentication should work to permit access to
 Calendar. I believe OAuth2 is the preferred authentication option so I have
 a client_secrets.json file with the ClientID and Client Secret from an API
 Access project I have separately created:
 {



 web:{

 auth_uri:https://accounts.google.com/o/oauth2/auth;,

 client_secret:xxx,

 token_uri:https://accounts.google.com/o/oauth2/token;,

 client_email:...@developer.gserviceaccount.com,

 redirect_uris:[https://myapp.appspot.com/oauth2callback;],

 client_x509_cert_url:
 https://www.googleapis.com/robot/v1/metadata/x509/...@developer.gserviceaccount.com
 ,

 client_id:123456789.apps.googleusercontent.com,

 auth_provider_x509_cert_url:https://www.googleapis.com/oauth2/v1/certs;
 ,

 javascript_origins:[https://myapp.appspot.com;]

 }

 }



 This was a direct export from the API Access project using the 'Download
 JSON' option. When I deploy my app engine application I get an error:
 Error: redirect_uri_mismatch



 The redirect URI in the request: http://myapp.appspot.com/oauth2callbackdid 
 not match a registered redirect URI

 Learn more http://code.google.com/apis/accounts/docs/OAuth2.html

 Request Details
 scope=https://www.googleapis.com/auth/calendar
 response_type=code
 access_type=offline
 redirect_uri=https://myapp.appspot.com/oauth2callback
 display=page
 client_id=123456789.apps.googleusercontent.com


 It all looks fine to me so I am not sure what the error is telling me. Do
 I need link the App Engine application to the API Access project in some
 way. Am I missing something else fundamental.


 If there is any additional information which will help you understand the
 set up please let me know. I wanted to keep the post small.


 Thanks


 James

 Notice:  This email is confidential and may contain copyright material of
 Ocado Limited (the Company). Opinions and views expressed in this message
 may not necessarily reflect the opinions and views of the Company.

 If you are not the intended recipient, please notify us immediately and
 delete all copies of this message. Please note that it is your
 responsibility to scan this message for viruses.

 Company reg. no. 3875000.

 Ocado Limited
 Titan Court
 3 Bishops Square
 Hatfield Business Park
 Hatfield
 Herts
 AL10 9NE

 --
 You received this message because you are subscribed to the Google Groups
 Google App Engine group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to google-appengine+unsubscr...@googlegroups.com.
 To post to this group, send email to google-appengine@googlegroups.com.
 Visit this group at http://groups.google.com/group/google-appengine?hl=en.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[google-appengine] App Engine to Calendar Authentication

2013-06-07 Thread James Gralton
 

Hi,


I am new to App Engine and am trying to write an application which will 
access Google Calendar to get details of any events for the current time. I 
am struggling to see how the authentication should work to permit access to 
Calendar. I believe OAuth2 is the preferred authentication option so I have 
a client_secrets.json file with the ClientID and Client Secret from an API 
Access project I have separately created:
{

 

web:{ 

auth_uri:https://accounts.google.com/o/oauth2/auth;, 

client_secret:xxx, 

token_uri:https://accounts.google.com/o/oauth2/token;, 

client_email:...@developer.gserviceaccount.com, 

redirect_uris:[https://myapp.appspot.com/oauth2callback;], 

client_x509_cert_url:
https://www.googleapis.com/robot/v1/metadata/x509/...@developer.gserviceaccount.com;
, 

client_id:123456789.apps.googleusercontent.com, 

auth_provider_x509_cert_url:https://www.googleapis.com/oauth2/v1/certs;, 

javascript_origins:[https://myapp.appspot.com;] 

} 

}



This was a direct export from the API Access project using the 'Download 
JSON' option. When I deploy my app engine application I get an error:
Error: redirect_uri_mismatch

 

The redirect URI in the request: http://myapp.appspot.com/oauth2callback 
did not match a registered redirect URI 

Learn more http://code.google.com/apis/accounts/docs/OAuth2.html 

Request Details 
scope=https://www.googleapis.com/auth/calendar 
response_type=code 
access_type=offline 
redirect_uri=https://myapp.appspot.com/oauth2callback 
display=page 
client_id=123456789.apps.googleusercontent.com


It all looks fine to me so I am not sure what the error is telling me. Do I 
need link the App Engine application to the API Access project in some way. 
Am I missing something else fundamental.


If there is any additional information which will help you understand the 
set up please let me know. I wanted to keep the post small.


Thanks


James

-- 
Notice:  This email is confidential and may contain copyright material of 
Ocado Limited (the Company). Opinions and views expressed in this message 
may not necessarily reflect the opinions and views of the Company.

If you are not the intended recipient, please notify us immediately and 
delete all copies of this message. Please note that it is your 
responsibility to scan this message for viruses.

Company reg. no. 3875000.

Ocado Limited
Titan Court
3 Bishops Square
Hatfield Business Park
Hatfield
Herts
AL10 9NE

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.