add window message listener to auth-callback template #129
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
My Hope:
You can tell me there's a better way... but if not...
What is this?
Context/Ramblings: (Copied and modified from superlogin pouchdb slack channel)
Ok, I had everything working nice and neato - but the moment I turned on
https
it backfired…Using
superlogin
andsuperlogin-client
to implement in the browser Facebook oauth, it used to work great when my site was on anhttp
only connection.The moment I stuck a cloudfront
https
configuration in front of it the following scenario started failing…After completing my OAuth login - the redirection back to my site:
https://mysite.com/auth/facebook/callback/code=...
returns this page: https://github.com/colinskow/superlogin/blob/master/templates/oauth/auth-callback.ejs in a popup window.But when that page tries to run it raises the following error:
on this line: https://github.com/colinskow/superlogin/blob/master/templates/oauth/auth-callback.ejs#L15
I found this StackOverlow post which talks about tackling the problem possibly another way: http://stackoverflow.com/questions/18625733/how-do-i-get-around-window-opener-cross-domain-security
I gave it a shot and was able to work-around my issue.
I believe that this code should work as it used to, while also enabling this possible new approach.
Below is the (ugly) client-side code used to request the token:
Using it with superlogin-client