In case any one is reading this later, the solution I settled on was
porting the Python xoauth.py script to Java and integrating into my
app. In retrospect, this was a stupid idea and wholly unnecessary. :-)
Because, at the end of the day, the behaviour is *identical* to the
solution described here: 
http://blog.doityourselfandroid.com/2010/11/10/oauth-flow-in-android-app/.
This still requires the user to grant access outside the usual Android
framework, which is unfortunate... Oh well.

On the plus side, I learned some Python. So I guess it wasn't a
complete waste of time.

On Jan 20, 11:42 am, Kookamonga <site...@yahoo.ca> wrote:
> I want to be able to send mail using GMail without user intervention
> in my app. I was able to do this using the Google example here:
>
> http://code.google.com/p/google-mail-xoauth-tools/wiki/JavaSampleCode
>
> Note, though, that that sample code uses a Python script (xoauth.py)
> to obtain the oauth_token and oauth_token_secret parameters in order
> to be able to connect to the GMail servers. This involves running the
> script, obtaining a verification URL which you then have to visit to
> grant access to your "app", then supplying the script with the
> verification code returned by Google and finally obtaining the
> oauth_token and oauth_token_secret values. Of course, I want to be
> able to do this in my app.
>
> In Android, one can obtain some sort of an authToken using
> AccountManager.getAuthToken(). Following this 
> link:http://stackoverflow.com/questions/6649388/android-accountmanager-aut...,
> I have tried using that authTokenType value, but I never get an
> auth_token_secret value back... After TONS of reading/searching, I
> think the problem here is that the AccountManager method is returning
> a ClientLogin authToken, whereas the sample implementation (first link
> I gave) requires XOAuth tokens. So finally, the question: is there any
> way to get from the ClientLogin token returned by the
> AccountManager.getAuthToken(...) method to the XOAuth tokens used by
> the sample app?
>
> This (http://groups.google.com/group/google-accounts-api/browse_thread/
> thread/df3a6382a01d73ab) claims that it is a matter of using an
> appropriate URL. I have not been able to get this to work.
>
> This (http://blog.doityourselfandroid.com/2010/11/10/oauth-flow-in-
> android-app/) explains how to get the OAuth tokens as part of your
> Android app... But the whole point of me wanting to use AccountManager
> is so that users of my app don't have to enter their password into the
> app...
>
> This (http://code.google.com/p/google-api-java-client/source/browse/
> tasks-android-sample/src/main/java/com/google/api/services/samples/
> tasks/android/TasksSample.java?repo=samples) shows how to use the
> AccountManager.getAuthToken(...) token to access a different Google
> API (Tasks). But again, I'm using the *Google provided* sample for
> Mail... And that seems to require something other than the ClientLogin
> credentials returned by AccountManager.
>
> I realize this is sort of a long, involved question. But after lots of
> looking, I'm hoping someone can help.
>
> Thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to