Out of curiosity, why do you prefer the localhost redirect URI as
opposed to OOB? In both cases you need an embedded view
Thanks,
Marius
See comments below...
On Mon, Aug 8, 2011 at 3:10 PM, Davy De Waele <ddew...@gmail.com> wrote:
> I guess it feels more natural, simpler and cleaner to intercept a callback
> URL and fetch a request parameter.
> I'm also not sure that in Android / iOS it's that easy to retrieve the title
> of the embedded view. That would mean we would need to resort to polling the
> embedded view content, retrieving the HTML, parsing the HTML title tag,
> ....... seems like a lot of messy code to me :)
I see. Would a specific query parameter on the OOB page URL help?
> Obviously, having the user do copy-pasting is also not an option (don't
> understand why that option is even mentioned). I wonder if people actually
> doing implementation like that ?
Copy-paste is the absolute simplest implementation. It can help in
developer mode, if nothing else. There are very simple command line
clients that print out a URL, you follow them in a browser and at the
end you copy-paste the authorization code back to the tool.
> When I started with Oauth (1.0), I went on to understand the internals (from
> OAuth 1.0 to 2.0). I think it's interesting to know what happens on the
> hood.
> However, as a developer, I don't want to be bothered with these internals in
> my code. I want a higher abstraction of the entire OAuth spec.
>
> The Google APIs Client Library for Java provides me that abstraction, and
> intercepting a callback URL to fetch a request param is something I'm
> willing to do. Anything beyond that is to messy for me :)
Yes, makes sense. I see your point.
> Don't know if it's the good approach, but it works for me. I had high hopes
> for the Android AccountManager integration with OAuth 2.0, as that looked
> like a good (browserless) solution, but I don't think it's production ready
> yet. .
True, if it was ready then the account manager would be the best option.
Marius
Hi,See comments below...
>I see. Would a specific query parameter on the OOB page URL help?
In both cases technically the flow is the same. With OOB the redirect
URI is different/special, that's the only difference.
Also, in both cases when you register the client you have to register
it as a native app. Native apps are allowed to use any localhost
redirect URI. Ideally the client can use an embedded web server in
which case there is no need for embedded web view. So, localhost is
definitely one of the main options for native apps.
On Windows for example it is very difficult to deal with localhost
URLs, firewalls and security policies will prevent a redirect to such
URLs.
Marius
On Mon, Aug 8, 2011 at 4:20 PM, Davy De Waele <ddew...@gmail.com> wrote:
> I see your point.
> When I referred to native flow before, I was referring to the
> urn:ietf:wg:oauth:2.0:oob redirection uri usage only, not so much the
> concept of a "native client".
> Is there any difference between registering a native client and a web based
> client. (each support a redirection URI to localhost, so no difference
> there).
> Does Google do any special handling based on the client type
> (besides urn:ietf:wg:oauth:2.0:oob usage) ?
Google limits what features and flows are available to a native
client. You can do only the web server flow for now, and
auto-approvals will never be enabled. On the other hand, a native
client does not have to explicitly register any redirect URIs.OOB and
localhost just work.
The wording on the consent page is also different for web and native apps.
> A lot of cmd line examples start an embedded server, and point the callback
> to the server using a landing page to do the cleanup.
> I don't know if it would be advisable in an Android app to start an embedded
> server, and it wouldn't work on iOS.
Right, the embedded web server would work only on desktop, and will
probably not work on Windows.
> But in general, registering a native client, using a localhost callback on
> an Android/iOS platform is perfectly OK if I understand correctly ?
Not sure. You are relying on the fact that some "unable to connect"
message is shown and that query parameters are preserved. Is this
guaranteed to be the case? What if the web view code in the OS or some
system policy breaks that?
Marius
Not sure. You are relying on the fact that some "unable to connect"
message is shown and that query parameters are preserved. Is this
guaranteed to be the case? What if the web view code in the OS or some
system policy breaks that?