torii-cordova
v0.0.1
Published
Addon to use torii authentication in Cordova using SafariViewController.
Downloads
3
Maintainers
Readme
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
- Register a custom url scheme with your app, e.g.
mycoolapp://
- 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
}
}
}
};
}
- 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.