Where is the Android Authorization Token Type alias list for Google APIs?
Asked Answered
S

3

11

While following this tutorial on using OAuth 2 with the Android AccountManager, I'm told that when specifying the AUTH_TOKEN_TYPE, instead of specifying the scope like this:

String AUTH_TOKEN_TYPE = "oauth2:https://www.googleapis.com/auth/tasks";

you can use its alias:

String AUTH_TOKEN_TYPE = "Manage your tasks";

This allows for a user to understand what the permissions are about instead of being given a URL. I am trying to figure out what the alias would be for the Google Documents List API.

The document then points to a list of auth token aliases, which unfortunately does not exist. There is also a related Youtube video in which the developer mentions a Google Buzz alias and also mentions that a list of aliases will be set up at some point.

What can I use instead of the Google Docs scope?

String AUTH_TOKEN_TYPE = "oauth2:https://docs.google.com/feeds/"
Stanford answered 11/3, 2012 at 11:48 Comment(4)
Have u found a solution for that?Commensal
@YanChengCHEOK - No solution yet, I have left it at the string at the end of my post above. If you happen to find something, please post here.Stanford
Thanks. Are you a truely Mizuki Oshiro? :)Commensal
Anyway, Google released a new version of Google Drive SDK for Android. They seem to have more functionality than previous.Commensal
G
4

I found this list which seems to contain possible aliases for the auth token type for various Google services: http://code.google.com/intl/ja/apis/gdata/faq.html#clientlogin

Although it is not particular user-friendly, it seems like you may be able to use 'writely' as the alias for retrieving the documents list. A Google search for AUTH_TOKEN_TYPE = 'writely'; returns a few results, which looks promising!

Gastronomy answered 11/3, 2012 at 12:9 Comment(3)
Thanks. I used 'writely' and the AccountManager dialog that showed up had 'Google Docs' on it. I haven't gotten to the actual usage (uploading) yet but I will try it soon.Stanford
Update - that didn't work. Although writely does get recognized as 'Google Docs' on the Account Manager screen, it doesn't seem to allow any calls to the Google Documents List API, returning a 401 each time. Changing it back to the 'oauth2:...' works fine. I'll keep this thread open in case someone from the future decides to respond.Stanford
The way this works is the name you want to appear should be what you enter. For example, saying "Manage Your Tasks" causes "Manage Your Tasks" to appear as what is being requested. So if you want "Google Docs" to appear, try writing just "Google Docs". That probably won't work though, as these seem to be essentially magic numbers, but worse, because they're magic strings (thus your chances of finding them are less, assuming you try them at random)... some strings actually point at something, most don't.Minimum
M
3

I'm attempting to access Google Drive, not Docs, but here's what I entered for an Authorization Token Type:

String AUTH_TOKEN_TYPE = "oauth2:" + DriveScopes.DRIVE;

DriveScopes is a list of possible authorization scopes. DriveScopes.DRIVE is the specific string from the list that gets me the particular scope I want. (It returns "https://www.googleapis.com/auth/drive".)

I append "oauth2:" to the front to specify that I want an Oauth2 token.

This code causes the user to be asked permission for "Your Drive to be Managed" or something like that. It didn't pop up revealing the address.

Hope this helps someone else find the similar code they need to find their own AUTH_TOKEN_TYPE. (Maybe in your case try DocScopes or DocsScopes, insert a period and see what Eclipse suggests as autocomplete?)

Minimum answered 6/9, 2012 at 15:1 Comment(0)
G
1

Supposedly this has been fixed in Ice Cream Sandwich (haven't been able to test it yet): https://plus.google.com/u/0/112215288642007559493/posts/Zme5LNLwCDP

I suppose that you could use the short names in Gingerbread, and plain names in ICS.

Glazer answered 3/5, 2013 at 10:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.