i'll take this opportunity to mention 3 considerations regarding OAuth
and unhosted web apps:
1) For remoteStorage i think OAuth implicit grant flow is still the
right choice. we don't generally use client pre-registration and so we
ignore the client_id parameter, identifying apps by the origin
(protocol/host/port) of their redirect_uri instead. This is because
generally the storage provider has no idea of which apps the user will
want to connect with, and also it's not generally the storage provider's
job to whitelist apps.
2) Unhosted web apps can also use OAuth to connect with for instance
the Flattr api, because that api offers implicit grant flow OAuth and
CORS headers on the api itself. you do generally have to register your
app's redirect_uri with the service, so that the service knows who
developed which app. This means the app cannot easily be mirrored
anymore, but otherwise this is not a big problem.
3) However, some APIs (dropbox, github) offer OAuth 1, with client
secrets. github explicitly tell you never to publish your client secret,
which is probably a way for them to trace the origin of their api
traffic, in case they need to selectively shut it down. this stems from
the "hosted software" paradigm, where the app that connects with the api
runs on a server.
i'm creating functionality for the "Terms of Service; Didn't Read"
website (which is an unhosted web app) where a user can submit pull
requests once they OAuthed to github. I'm inclined to simply publish the
tosdr client secret inside the app, rather than hiding it in a proxy.
Dropbox, in their dropbox.js documentation, advise you to publish your
client secret. This sounds a bit weird but it makes sense for unhosted
web apps. see also
http://stackoverflow.com/questions/6737918/oauth-embedding-client-secret-in-your-application#6766574
the point is, if you hide the client secret in a proxy, then it's
effectively the same thing, an attacker could still do bad things to
github and make github think that our app has something to do with it.
you could limit the things such a proxy would allow through, but
otherwise, the api should probably just be protecting itself against
what a user sends it. there would also be little incentive for an
attacker to use our client secret, because it's very easy to obtain one
directly from github (easier actually than prying it out of our source
code).
For comparison, NimbusBase also publishes the dropbox client secret in
their sample app, so this would be comparable to that set up.
https://github.com/winterlightning/tweetdiary/blob/gh-pages/dropbox.js
But i'm still a bit afraid to get this wrong, especially because unlike
for dropbox, the documentation for github is so explicit in forbidding
it, so i will think it through some more, and maybe i'll use an
unbranded app registration, so that the brand is not affected if someone
would use it for malicious purposes.
Cheers,
Michiel