OAuth authorization

  • Hi
    I’m trying to implement OAUTH authorization and I’m not really good at it yet 🙂
    It should be done width the Cordova plugin InAppBrowser, or it can be done with IFRAME ? Or something else …
    Does anyone have an example of using OAuth authorization?
    Thanks a lot

  • Which OAUTH grant type do you want to use? I guess the Authorization Code Grant, which is used when you log in via Google or Facebook?
    Facebook and Google do have Client side libraries which handle all the stuff. If it’s your own implementation or another provider, there are libraries for general OAUTH you could use (eg. https://github.com/oauth-io/oauth-js - haven’t tried it myself) or you could do it by yourself, normally you use a redirect / new tab and pass a return url. This is no problem in a browser but I don’t know how it is handled in cordova, but I guess it should work too. 🙂

    This boilerplate-kit has examples for the most common OAUTH Providers: https://github.com/sahat/hackathon-starter
    It should work the same in an SPA

Log in to reply