Created
February 23, 2016 17:47
-
-
Save muffinresearch/14a07ab7e6471af4fb78 to your computer and use it in GitHub Desktop.
fxa-login.js.diff
This file contains hidden or 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
diff --git a/static/js/common/fxa-login.js b/static/js/common/fxa-login.js | |
index 2f6428b..9ff32c4 100644 | |
--- a/static/js/common/fxa-login.js | |
+++ b/static/js/common/fxa-login.js | |
@@ -32,13 +32,20 @@ function enableFxALogin() { | |
}); | |
} | |
+ // utf-8 handling from https://mzl.la/1LwX2Zx | |
+ function utf8Tob64(str) { | |
+ return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function(match, p1) { | |
+ return String.fromCharCode('0x' + p1); | |
+ })); | |
+ } | |
+ | |
function fxaLogin(opts) { | |
opts = opts || {}; | |
var authConfig = { | |
action: 'signin', | |
client_id: config.clientId, | |
email: opts.email || config.email, | |
- state: config.state + ':' + urlsafe(btoa(nextPath())), | |
+ state: config.state + ':' + urlsafe(utf8Tob64(nextPath())), | |
redirectUri: config.redirectUrl, | |
scope: config.scope, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment