torii-cordova

0.0.1 • Public • Published

torii-cordova

Addon to use torii authentication in Cordova using SafariViewController iOS component

The addon is based on a method described in the article here: Stop using InAppBrowser for your Cordova/Phonegap oAuth flow

It depends on Custom URL scheme and SafariViewController cordova plugins

Installation

ember install torii-cordova

Setup

  1. Register a custom url scheme with your app, e.g. mycoolapp://
  2. Confugure your Ember project to use cordova-popup
    // config/environment.js
    module.exports = function(environment) {
      var ENV = {
        torii: {
          sessionServiceName: 'session',
          providers: {
            '<provider-name>': {
              remoteServiceName: 'cordova-popup',
              redirectUri: 'http://localhost:4000/fw' // static html with JS
                                                      // for custom url scheme
                                                      // redirect
            }
          }
        }
      };
    }  
  1. You need a static web page hosted on your server in order to do redirect to your cordova app using custom url scheme.
<!DOCTYPE html>
<html>
  <head>
      <meta charset="UTF-8">
      <meta http-equiv="Content-Security-Policy" content="default-src 'none';script-src 'unsafe-inline';">
  </head>
  <body>
      <script>window.location.assign('mycoolapp://token' + window.location.hash);</script> 
  </body>
</html>

Please read Stop using InAppBrowser for your Cordova/Phonegap oAuth flow article for details.

Package Sidebar

Install

npm i torii-cordova

Weekly Downloads

0

Version

0.0.1

License

MIT

Last publish

Collaborators

  • arkadiyk