Skip to content

Addon to use torii authentication in Cordova using SafariViewController iOS component

License

Notifications You must be signed in to change notification settings

arkadiyk/torii-cordova

Repository files navigation

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.

About

Addon to use torii authentication in Cordova using SafariViewController iOS component

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published