forked from lynndylanhurley/devise_token_auth
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(improved-omniauth): add support for sameWindow and inAppBrowser …
…omniauth flows
- Loading branch information
1 parent
14b66a9
commit e3e24b7
Showing
23 changed files
with
459 additions
and
260 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<a name="0.1.33"></a> | ||
# 0.1.33 (2015-08-09) | ||
|
||
## Features | ||
|
||
- **Improved OAuth Flow**: Supports new OAuth window flows, allowing options for `sameWindow`, `newWindow`, and `inAppBrowser` | ||
|
||
## Breaking Changes | ||
|
||
- The new OmniAuth callback behavior now defaults to `sameWindow` mode, whereas the previous implementation mimicked the functionality of `newWindow`. This was changed due to limitations with the `postMessage` API support in popular browsers, as well as feedback from user-experience testing. |
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
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,10 @@ | ||
+<a name="0.1.33"></a> | ||
+# 0.1.33 (2015-??-??) | ||
+ | ||
+## Features | ||
+ | ||
+- **Improved OAuth Flow**: Supports new OAuth window flows, allowing options for `sameWindow`, `newWindow`, and `inAppBrowser` | ||
+ | ||
+## Breaking Changes | ||
+ | ||
+- The new OAuth redirect behavior now defaults to `sameWindow` mode, whereas the previous implementation mimicked the functionality of `newWindow`. This was changed due to limitations with the `postMessage` API support in popular browsers, as well as feedback from user-experience testing. |
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
38 changes: 38 additions & 0 deletions
38
app/views/devise_token_auth/omniauth_external_window.html.erb
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,38 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script> | ||
/* | ||
The data is accessible in two ways: | ||
1. Using the postMessage api, this window will respond to a | ||
'message' event with a post of all the data. (This can | ||
be used by browsers other than IE if this window was | ||
opened with window.open()) | ||
2. This window has a function called requestCredentials which, | ||
when called, will return the data. (This can be | ||
used if this window was opened in an inAppBrowser using | ||
Cordova / PhoneGap) | ||
*/ | ||
|
||
var data = <%= @data.to_json.html_safe %>; | ||
|
||
window.addEventListener("message", function(ev) { | ||
if (ev.data === "requestCredentials") { | ||
ev.source.postMessage(data, '*'); | ||
window.close(); | ||
} | ||
}); | ||
function requestCredentials() { | ||
return data; | ||
} | ||
setTimeout(function() { | ||
window.getElementById('text').innerHTML = 'Redirecting...'; | ||
}, 1000); | ||
</script> | ||
</head> | ||
<body> | ||
<pre id="text"> | ||
</pre> | ||
</body> | ||
</html> |
Oops, something went wrong.