Skip to content

Commit 2b84a47

Browse files
committed
Detect cordova and override token refresh approach to use window.open hidden, MrSwitch#298
1 parent a86a5a5 commit 2b84a47

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

Gruntfile.js

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ module.exports = function(grunt) {
3535
'src/hello.polyfill.js',
3636
'src/hello.js',
3737
'src/hello.chromeapp.js',
38+
'src/hello.phonegap.js',
3839
'src/hello.amd.js',
3940
'src/hello.commonjs.js'
4041
],

demos/profile.html

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<script src="client_ids.js"></script>
77
<script src="../src/hello.polyfill.js"></script>
88
<script src="../src/hello.js"></script>
9+
<script src="../src/hello.phonegap.js"></script>
910
<script src="../src/hello.chromeapp.js"></script>
1011
<script src="../src/modules/windows.js"></script>
1112
<script src="../src/modules/facebook.js"></script>

src/hello.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ hello.utils.extend(hello, {
391391
// Trigger how we want self displayed
392392
if (opts.display === 'none') {
393393
// Sign-in in the background, iframe
394-
utils.iframe(url);
394+
utils.iframe(url, redirectUri);
395395
}
396396

397397
// Triggering popup?

src/hello.phonegap.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Phonegap override for hello.phonegap.js
2+
(function() {
3+
4+
// Is this a phonegap implementation?
5+
if (!(/^file:\/{3}[^\/]/.test(window.location.href) && window.cordova)) {
6+
// Cordova is not included.
7+
return;
8+
}
9+
10+
// Augment the hidden iframe method
11+
hello.utils.iframe = function(url, redirectUri) {
12+
hello.utils.popup(url, redirectUri, {hidden: 'yes'});
13+
};
14+
})();

0 commit comments

Comments
 (0)