Index: remoting/webapp/me2mom/remoting.js |
diff --git a/remoting/webapp/me2mom/remoting.js b/remoting/webapp/me2mom/remoting.js |
index 8947e59d0ac58e9b66f97a42ecf007097efbb800..1b5590469f0f7d425e3ec945c671e67bb214af30 100644 |
--- a/remoting/webapp/me2mom/remoting.js |
+++ b/remoting/webapp/me2mom/remoting.js |
@@ -147,6 +147,27 @@ remoting.init = function() { |
remoting.debug = |
new remoting.DebugLog(document.getElementById('debug-messages')); |
+ // Process OAuth redirection |
+ if (window.location.search) { |
+ var parts = window.location.search.substring(1).split('&'); |
+ var queryArgs = {}; |
+ for (var i = 0; i < parts.length; i++) { |
+ var pair = parts[i].split('='); |
+ queryArgs[pair[0]] = pair[1]; |
+ } |
+ // If this an OAuth2 redirect, then strip the parameters from the URL |
+ // to prevent them getting stored in bookmarks. |
+ if ('code' in queryArgs) { |
+ remoting.oauth2.exchangeCodeForToken(queryArgs['code'], function() { |
+ window.location.replace(chrome.extension.getURL('choice.html')); |
+ }); |
+ return; |
+ } else if ('error' in queryArgs) { |
+ window.location.replace(chrome.extension.getURL('choice.html')); |
+ return; |
Jamie
2011/08/04 21:56:16
Does location.replace automatically terminate the
awong
2011/08/04 22:42:36
I think it does go immediately, but the return sti
|
+ } |
+ } |
+ |
refreshEmail_(); |
var email = getEmail(); |
if (email) { |