-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redirect oauth requests based on gecko support
- Loading branch information
Showing
4 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>OAuth Redirection</title> | ||
<script defer src="redirect.js"></script> | ||
</head> | ||
<body> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
'use strict'; | ||
|
||
var Redirect = function Redirect() { | ||
|
||
var ORIGIN = document.location.protocol + '//' + | ||
document.location.host; | ||
|
||
var init = function init() { | ||
var hash = document.location.hash.substring(1); | ||
var parameters = {}; | ||
|
||
var dataStart = hash.indexOf('access_token'); | ||
|
||
if (dataStart !== -1) { | ||
var elements = hash.split('&'); | ||
|
||
elements.forEach(function(p) { | ||
var values = p.split('='); | ||
parameters[values[0]] = values[1]; | ||
}); | ||
|
||
window.opener.postMessage(parameters, ORIGIN); | ||
window.close(); | ||
} | ||
|
||
}; | ||
|
||
return { | ||
'init': init | ||
}; | ||
|
||
}(); | ||
|
||
Redirect.init(); |