<font face="trebuchet ms,sans-serif" style="color:rgb(34,34,34);font-size:13.333333969116211px;background-color:rgb(255,255,255)">This is a shameless plug, but if you want a much easier to understand method of accessing protected resources via OAuth2, I have a 55 LOC client implementation with docs and examples here:</font><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13.333333969116211px;background-color:rgb(255,255,255)"> </span><a href="https://github.com/demianbrecht/sanction" target="_blank" style="color:rgb(17,85,204);font-family:arial,sans-serif;font-size:13.333333969116211px;background-color:rgb(255,255,255)">https://github.com/demianbrecht/sanction</a><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13.333333969116211px;background-color:rgb(255,255,255)"> (Google is one of the tested providers with an access example).</span><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13.333333969116211px;background-color:rgb(255,255,255)">
<br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13.333333969116211px;background-color:rgb(255,255,255)">Are you trying to access resources client side (through Javascript) or server side? Either way, the redirect URI *is* important. The first step is to have your user authorize your application using Google's authorization page. As one of the query parameters, you must specify the redirect URI (which must match those registered through Google's app console).</div>
<div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13.333333969116211px;background-color:rgb(255,255,255)"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13.333333969116211px;background-color:rgb(255,255,255)">
Once the user has authorized your application, they're redirected back to your site (via the specified redirect URI), with a "code" attached as a query param. Once you get that code, you must exchange that with Google's token endpoint to retrieve the access and refresh tokens.</div>
<div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13.333333969116211px;background-color:rgb(255,255,255)"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13.333333969116211px;background-color:rgb(255,255,255)">
No, it doesn't matter which library you use. Google's (imho) is overly verbose and difficult to grok (especially for someone new to either OAuth 2.0 or Python, or both). The client ID doesn't need to be kept private, but the secret does. You should *never* put this anywhere that can be read publicly.</div>
<br><div class="gmail_quote">On Tue, Sep 25, 2012 at 12:04 PM, Littlefield, Tyler <span dir="ltr"><<a href="mailto:tyler@tysdomain.com" target="_blank">tyler@tysdomain.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello all:<br>
I've been trying  to figure out the oauth2client part of google's api, and I am really confused.<br>
It shows a flow, and even with the client flow, you need a redirect uri. This isn't important because I just want to get both an access and refresh token.<br>
Has anyone had any experience with this? Is it  easier to use a more developed oauth2 library to handle this? If so, can anyone make any suggestions?<br>
<br>
If I understand everything correctly, it doesn't matter what library I would use to work with the oauth2 protocol, so I could break out of this workflow thing that looks like it's more designed for web apps.<br>
Finally, they caution you about being careful about your client id and your client secret; is  there much in the way of obviscation or something I can do to keep this secret?<span class="HOEnZb"><font color="#888888"><br>

<br>
-- <br>
Take care,<br>
Ty<br>
<a href="http://tds-solutions.net" target="_blank">http://tds-solutions.net</a><br>
The aspen project: a barebones light-weight mud engine:<br>
<a href="http://code.google.com/p/aspenmud" target="_blank">http://code.google.com/p/<u></u>aspenmud</a><br>
He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave.<br>
<br>
-- <br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/<u></u>mailman/listinfo/python-list</a><br>
</font></span></blockquote></div><br>