how does the meteor-accounts oauth workflow happen -


i'm trying use accounts-facebook ionic cli. i'm using client side bundler script can't entire oauth workflow complete.

i set standard account-facebook config meteor-angular-socially project , discovered i'm getting stuck @ oauth redirect uri. following method never called in client-side bundle

// in script: oauth/oauth_client.js // called popup when oauth flow completed, right before // popup closes. oauth._handlecredentialsecret = function (credentialtoken, secret) {   check(credentialtoken, string);   check(secret, string);   if (! _.has(credentialsecrets,credentialtoken)) {     credentialsecrets[credentialtoken] = secret;   } else {     throw new error("duplicate credential token oauth login");   } };  

i following redirect url oauth should load page

# http://localhost:3000/_oauth/facebook/?code=[...]&state=[...] <!doctype html> <html> <body>   <p id="completedtext" style="display:none;">     login completed. <a href="#" id="logincompleted">       click here</a> close window.   </p>    <div id="config" style="display:none;">{     "setcredentialtoken":false,     "storageprefix":"meteor.oauth.credentialsecret-",     "iscordova":false   }</div>   <script type="text/javascript" src="/_oauth/facebook/end_of_popup_response.js">     # script included inline ease of reading     (function () {        var config = json.parse(document.getelementbyid("config").innerhtml);        if (config.setcredentialtoken) {         var credentialtoken = config.credentialtoken;         var credentialsecret = config.credentialsecret;          if (config.iscordova) {           var credentialstring = json.stringify({             credentialtoken: credentialtoken,             credentialsecret: credentialsecret           });            window.location.hash = credentialstring;         }          if (window.opener && window.opener.package &&               window.opener.package.oauth) {           window.opener.package.oauth.oauth._handlecredentialsecret(             credentialtoken, credentialsecret);         } else {           try {             localstorage[config.storageprefix + credentialtoken] = credentialsecret;           } catch (err) {             // can't else, @ least close popup instead             // of having hang around on blank page.           }         }       }        if (! config.iscordova) {         document.getelementbyid("completedtext").style.display = "block";         document.getelementbyid("logincompleted").onclick = function(){ window.close(); };         window.close();       }     })();   </script> </body> </html> 

in standard meteor cli config, somehow/somwhere config.setcredentialtoken === true , config.setcredentialtoken , config.credentialsecret set. cannot figure out where/when happens.

in accounts-facebook-client-side.bundle.js, none of happens.

update

i realized magic happens on meteor server side. if set oauth redirect_uri port meteor server running, following in ./_oauth/facebook page:

<div id="config" style="display:none;">{ "setcredentialtoken":true, "credentialtoken":"bsgezrfbk-urur1ix81deitir0t5nc_a1hm4-egsgx5", "credentialsecret":"hi8rjxbyosi0gvaoihrr7n9kh9k2fku1dyqxp5bmqmt", "storageprefix":"meteor.oauth.credentialsecret-", "iscordova":false }</div> 

but, guessing if that, won't able read these values localstorage(?) on web.browser client page (port 3000)

any ideas workaround?

simplest way fix put nginx in front of app , use proxy_pass sort calls towards ionic's server , meteor's server based on path:

server {     listen       80;     server_name  domain.tld;      location / {         proxy_pass http://domain.tld:8100;     }     location /_oauth {         proxy_pass http://domain.tld:3000;     }     location /packages {         proxy_pass http://domain.tld:3000;     } } 

i tried method accounts-facebook , works flawlessly (you need point browser http://domain.tld:80 instead of http://domain.tld:8100), started digging deeper meteor's code see if can accomplish better. edit answer if find better solution.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -