// ng-cordova-oauth - v0.3.0 (2018-06-29) // http://www.nraboy.com !function(){"use strict";function a(a,b,c){function d(b,d){var e=a.defer();if(window.cordova)if(c.isInAppBrowserInstalled()){var f="http://localhost/callback";void 0!==d&&d.hasOwnProperty("redirect_uri")&&(f=d.redirect_uri);var g=window.cordova.InAppBrowser.open("https://api.500px.com/v1/api/js-sdk/authorize?sdk_key="+b+"&callback="+f,"_blank","toolbar=no,zoom=no,location=no,clearsessioncache=yes,clearcache=yes");g.addEventListener("loadstart",function(a){if(0===a.url.indexOf(f)){var b=a.url.split("#token:")[1].split(",")[0];e.resolve({error:!1,success:!0,access_token:b,callback:f})}else e.reject({success:!1,callback:f,error:!0,access_token:null})}),g.addEventListener("exit",function(a){e.reject("The sign in flow was canceled")})}else e.reject("Could not find InAppBrowser plugin");else e.reject("Cannot authenticate via a web browser");return e.promise}return{signin:d}}angular.module("oauth.500px",["oauth.utils"]).factory("$ngCordova500px",a),a.$inject=["$q","$http","$cordovaOauthUtility"]}(),function(){"use strict";function a(a,b,c){function d(d,e,f){var g=a.defer();if(window.cordova)if(c.isInAppBrowserInstalled()){var h=window.cordova.InAppBrowser.open(e+"/adfs/oauth2/authorize?response_type=code&client_id="+d+"&redirect_uri=http://localhost/callback&resource="+f,"_blank","location=no");h.addEventListener("loadstart",function(a){if(0===a.url.indexOf("http://localhost/callback")){var c=a.url.split("code=")[1];b({method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded"},url:e+"/adfs/oauth2/token",data:"client_id="+d+"&code="+c+"&redirect_uri=http://localhost/callback&grant_type=authorization_code"}).success(function(a){g.resolve(a)}).error(function(a,b){g.reject("Problem authenticating")})["finally"](function(){setTimeout(function(){h.close()},10)})}}),h.addEventListener("exit",function(a){g.reject("The sign in flow was canceled")})}else g.reject("Could not find InAppBrowser plugin");else g.reject("Cannot authenticate via a web browser");return g.promise}return{signin:d}}angular.module("oauth.adfs",["oauth.utils"]).factory("$ngCordovaAdfs",a),a.$inject=["$q","$http","$cordovaOauthUtility"]}(),function(){"use strict";function a(a,b,c){function d(d,e,f){var g=a.defer();if(window.cordova)if(c.isInAppBrowserInstalled()){var h=window.cordova.InAppBrowser.open("https://login.microsoftonline.com/"+e+"/oauth2/authorize?response_type=code&client_id="+d+"&redirect_uri=http://localhost/callback","_blank","location=no,clearsessioncache=yes,clearcache=yes");h.addEventListener("loadstart",function(a){if(0===a.url.indexOf("http://localhost/callback")){var c=a.url.split("code=")[1];console.log(c),b({method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded"},url:"https://login.microsoftonline.com/"+e+"/oauth2/token",data:"client_id="+d+"&code="+c+"&redirect_uri=http://localhost/callback&grant_type=authorization_code&resource="+f}).success(function(a){g.resolve(a)}).error(function(a,b){g.reject("Problem authenticating")})["finally"](function(){setTimeout(function(){h.close()},10)})}}),h.addEventListener("exit",function(a){g.reject("The sign in flow was canceled")})}else g.reject("Could not find InAppBrowser plugin");else g.reject("Cannot authenticate via a web browser");return g.promise}return{signin:d}}angular.module("oauth.azuread",["oauth.utils"]).factory("$ngCordovaAzureAD",a),a.$inject=["$q","$http","$cordovaOauthUtility"]}(),function(){"use strict";function a(a,b,c){function d(d,e,f,g){var h=a.defer();if(window.cordova)if(c.isInAppBrowserInstalled()){var i="http://localhost/callback";void 0!==g&&g.hasOwnProperty("redirect_uri")&&(i=g.redirect_uri);var j=window.cordova.InAppBrowser.open("https://app.box.com/api/oauth2/authorize/?client_id="+d+"&redirect_uri="+i+"&state="+f+"&response_type=code","_blank","location=no,clearsessioncache=yes,clearcache=yes");j.addEventListener("loadstart",function(a){if(0===a.url.indexOf(i)){var c=a.url.split("code=")[1];b({method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded"},url:"https://app.box.com/api/oauth2/token",data:"client_id="+d+"&client_secret="+e+"&redirect_uri="+i+"&grant_type=authorization_code&code="+c}).success(function(a){h.resolve(a)}).error(function(a,b){h.reject("Problem authenticating")})["finally"](function(){setTimeout(function(){j.close()},10)})}}),j.addEventListener("exit",function(a){h.reject("The sign in flow was canceled")})}else h.reject("Could not find InAppBrowser plugin");else h.reject("Cannot authenticate via a web browser");return h.promise}return{signin:d}}angular.module("oauth.box",["oauth.utils"]).factory("$ngCordovaBox",a),a.$inject=["$q","$http","$cordovaOauthUtility"]}(),function(){"use strict";function a(a,b,c){function d(d,e,f){var g=a.defer();if(window.cordova)if(c.isInAppBrowserInstalled()){var h="http://localhost/callback";void 0!==f&&f.hasOwnProperty("redirect_uri")&&(h=f.redirect_uri);var i=window.cordova.InAppBrowser.open("https://cloud.digitalocean.com/v1/oauth/authorize?client_id="+d+"&redirect_uri="+h+"&response_type=code&scope=read%20write","_blank","location=no,clearsessioncache=yes,clearcache=yes");i.addEventListener("loadstart",function(a){if(0===a.url.indexOf(h)){var c=a.url.split("code=")[1];b({method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded"},url:"https://cloud.digitalocean.com/v1/oauth/token",data:"client_id="+d+"&client_secret="+e+"&redirect_uri="+h+"&grant_type=authorization_code&code="+c}).success(function(a){g.resolve(a)}).error(function(a,b){g.reject("Problem authenticating")})["finally"](function(){setTimeout(function(){i.close()},10)})}}),i.addEventListener("exit",function(a){g.reject("The sign in flow was canceled")})}else g.reject("Could not find InAppBrowser plugin");else g.reject("Cannot authenticate via a web browser");return g.promise}return{signin:d}}angular.module("oauth.digitalOcean",["oauth.utils"]).factory("$ngCordovaDigitalOcean",a),a.$inject=["$q","$http","$cordovaOauthUtility"]}(),function(){"use strict";function a(a,b,c){function d(d,e,f,g,h){var i=a.defer();if(window.cordova)if(c.isInAppBrowserInstalled()){var j="http://localhost/callback",k="https://dribbble.com/oauth/authorize",l="https://dribbble.com/oauth/token";void 0!==g&&g.hasOwnProperty("redirect_uri")&&(j=g.redirect_uri),void 0===h&&(h=c.createNonce(5));var m=f.join(",").replace(/,/g,"+"),n=window.cordova.InAppBrowser.open(k+"?client_id="+d+"&redirect_uri="+j+"&scope="+m+"&state="+h,"_blank","location=no,clearsessioncache=yes,clearcache=yes");n.addEventListener("loadstart",function(a){if(0===a.url.indexOf(j)){var c=a.url.split("code=")[1],f=c.split("&")[0];b({method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded"},url:l,data:"client_id="+d+"&redirect_uri="+j+"&client_secret="+e+"&code="+f}).success(function(a){i.resolve(a)}).error(function(a,b){i.reject("Problem authenticating ")})["finally"](function(){setTimeout(function(){n.close()},10)})}}),n.addEventListener("exit",function(a){i.reject("The sign in flow was canceled")})}else i.reject("Could not find InAppBrowser plugin");else i.reject("Cannot authenticate via a web browser");return i.promise}return{signin:d}}angular.module("oauth.dribble",["oauth.utils"]).factory("$ngCordovaDribble",a),a.$inject=["$q","$http","$cordovaOauthUtility"]}(),function(){"use strict";function a(a,b,c){function d(b,d){var e=a.defer();if(window.cordova)if(c.isInAppBrowserInstalled()){var f="http://localhost/callback";void 0!==d&&d.hasOwnProperty("redirect_uri")&&(f=d.redirect_uri);var g=window.cordova.InAppBrowser.open("https://www.dropbox.com/1/oauth2/authorize?client_id="+b+"&redirect_uri="+f+"&response_type=token","_blank","location=no,clearsessioncache=yes,clearcache=yes");g.addEventListener("loadstart",function(a){if(0===a.url.indexOf(f)){g.removeEventListener("exit",function(a){}),g.close();for(var b=a.url.split("#")[1],c=b.split("&"),d=[],h=0;h0&&(k="&scope="+d.join("+"));var l="https://api.instagram.com/oauth/authorize/?client_id="+b+k+"&response_type="+i+"&redirect_uri="+h,m=window.cordova.InAppBrowser.open(l,"_blank","location=no,clearsessioncache=yes,clearcache=yes");m.addEventListener("loadstart",function(a){if(0===a.url.indexOf(h)){m.removeEventListener("exit",function(a){}),m.close();var b=a.url.split(g[i])[1],d=c.parseResponseParameters(b);d.access_token?f.resolve({access_token:d.access_token}):void 0!==d.code&&null!==d.code?f.resolve({code:d.code}):f.reject("Problem authenticating")}else a.url===j&&m.executeScript({code:"window.location = '"+l+"';"})}),m.addEventListener("exit",function(a){f.reject("The sign in flow was canceled")})}else f.reject("Could not find InAppBrowser plugin");else f.reject("Cannot authenticate via a web browser");return f.promise}return{signin:d}}angular.module("oauth.instagram",["oauth.utils"]).factory("$ngCordovaInstagram",a),a.$inject=["$q","$http","$cordovaOauthUtility"]}(),function(){"use strict";function a(a,b,c){function d(d,e,f,g){var h=a.defer();if(window.cordova)if(c.isInAppBrowserInstalled()){var i="http://localhost/callback";void 0!==g&&g.hasOwnProperty("redirect_uri")&&(i=g.redirect_uri);var j=window.cordova.InAppBrowser.open("https://jawbone.com/auth/oauth2/auth?client_id="+d+"&redirect_uri="+i+"&response_type=code&scope="+f.join(" "),"_blank","location=no,clearsessioncache=yes,clearcache=yes");j.addEventListener("loadstart",function(a){if(0===a.url.indexOf(i)){var c=a.url.split("code=")[1];b({method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded"},url:"https://jawbone.com/auth/oauth2/token",data:"client_id="+d+"&client_secret="+e+"&grant_type=authorization_code&code="+c}).success(function(a){h.resolve(a)}).error(function(a,b){h.reject("Problem authenticating")})["finally"](function(){setTimeout(function(){j.close()},10)})}}),j.addEventListener("exit",function(a){h.reject("The sign in flow was canceled")})}else h.reject("Could not find InAppBrowser plugin");else h.reject("Cannot authenticate via a web browser");return h.promise}return{signin:d}}angular.module("oauth.jawbone",["oauth.utils"]).factory("$ngCordovaJawbone",a),a.$inject=["$q","$http","$cordovaOauthUtility"]}(),function(){"use strict";function a(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R){return{azureAD:d.signin,adfs:e.signin,dropbox:f.signin,digitalOcean:g.signin,google:h.signin,github:i.signin,facebook:j.signin,linkedin:k.signin,instagram:l.signin,box:m.signin,reddit:n.signin,slack:o.signin,twitter:p.signin,meetup:q.signin,salesforce:r.signin,strava:s.signin,withings:t.signin,foursquare:u.signin,magento:v.signin,vkontakte:w.signin,odnoklassniki:x.signin,imgur:y.signin,spotify:z.signin,uber:A.signin,windowsLive:B.signin,yammer:C.signin,venmo:D.signin,stripe:E.signin,rally:F.signin,familySearch:G.signin,envato:H.signin,weibo:I.signin,jawbone:J.signin,untappd:K.signin,dribble:L.signin,pocket:M.signin,mercadolibre:N.signin,xing:O.signin,netatmo:P.signin,trakttv:Q.signin,yahoo:R.signin}}angular.module("oauth.providers",["oauth.utils","oauth.500px","oauth.azuread","oauth.adfs","oauth.dropbox","oauth.digitalOcean","oauth.google","oauth.github","oauth.facebook","oauth.linkedin","oauth.instagram","oauth.box","oauth.reddit","oauth.slack","oauth.twitter","oauth.meetup","oauth.salesforce","oauth.strava","oauth.withings","oauth.foursquare","oauth.magento","oauth.vkontakte","oauth.odnoklassniki","oauth.imgur","oauth.spotify","oauth.uber","oauth.windowslive","oauth.yammer","oauth.venmo","oauth.stripe","oauth.rally","oauth.familySearch","oauth.envato","oauth.weibo","oauth.jawbone","oauth.untappd","oauth.dribble","oauth.pocket","oauth.mercadolibre","oauth.xing","oauth.netatmo","oauth.trakttv","oauth.yahoo"]).factory("$cordovaOauth",a),a.$inject=["$q","$http","$cordovaOauthUtility","$ngCordovaAzureAD","$ngCordovaAdfs","$ngCordovaDropbox","$ngCordovaDigitalOcean","$ngCordovaGoogle","$ngCordovaGithub","$ngCordovaFacebook","$ngCordovaLinkedin","$ngCordovaInstagram","$ngCordovaBox","$ngCordovaReddit","$ngCordovaSlack","$ngCordovaTwitter","$ngCordovaMeetup","$ngCordovaSalesforce","$ngCordovaStrava","$ngCordovaWithings","$ngCordovaFoursquare","$ngCordovaMagento","$ngCordovaVkontakte","$ngCordovaOdnoklassniki","$ngCordovaImgur","$ngCordovaSpotify","$ngCordovaUber","$ngCordovaWindowslive","$ngCordovaYammer","$ngCordovaVenmo","$ngCordovaStripe","$ngCordovaRally","$ngCordovaFamilySearch","$ngCordovaEnvato","$ngCordovaWeibo","$ngCordovaJawbone","$ngCordovaUntappd","$ngCordovaDribble","$ngCordovaPocket","$ngCordovaMercadolibre","$ngCordovaXing","$ngCordovaNetatmo","$ngCordovaTraktTv","$ngCordovaYahoo"]}(),function(){"use strict";function a(a,b,c){function d(d,e,f,g,h){var i=a.defer();if(window.cordova)if(c.isInAppBrowserInstalled()){var j="http://localhost/callback";void 0!==h&&h.hasOwnProperty("redirect_uri")&&(j=h.redirect_uri);var k=window.cordova.InAppBrowser.open("https://www.linkedin.com/uas/oauth2/authorization?client_id="+d+"&redirect_uri="+j+"&scope="+f.join(" ")+"&response_type=code&state="+g,"_blank","location=no,clearsessioncache=yes,clearcache=yes");k.addEventListener("loadstart",function(a){if(0===a.url.indexOf(j))try{var c=a.url.split("code=")[1].split("&")[0];b({method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded"},url:"https://www.linkedin.com/uas/oauth2/accessToken",data:"client_id="+d+"&client_secret="+e+"&redirect_uri="+j+"&grant_type=authorization_code&code="+c}).success(function(a){i.resolve(a)}).error(function(a,b){i.reject("Problem authenticating")})["finally"](function(){setTimeout(function(){k.close()},10)})}catch(f){setTimeout(function(){k.close()},10)}}),k.addEventListener("exit",function(a){i.reject("The sign in flow was canceled")})}else i.reject("Could not find InAppBrowser plugin");else i.reject("Cannot authenticate via a web browser");return i.promise}return{signin:d}}angular.module("oauth.linkedin",["oauth.utils"]).factory("$ngCordovaLinkedin",a),a.$inject=["$q","$http","$cordovaOauthUtility"]}(),function(){"use strict";function a(a,b,c){function d(d,e,f){var g=a.defer();if(window.cordova)if(c.isInAppBrowserInstalled())if("undefined"!=typeof jsSHA){var h={oauth_callback:"http://localhost/callback",oauth_consumer_key:e,oauth_nonce:c.createNonce(5),oauth_signature_method:"HMAC-SHA1",oauth_timestamp:Math.round((new Date).getTime()/1e3),oauth_version:"1.0"},i=c.createSignature("POST",d+"/oauth/initiate",h,{oauth_callback:"http://localhost/callback"},f);b.defaults.headers.post.Authorization=i.authorization_header,b.defaults.headers.post["Content-Type"]="application/x-www-form-urlencoded",b({method:"post",url:d+"/oauth/initiate",data:"oauth_callback=http://localhost/callback"}).success(function(a){for(var e=a.split("&"),i={},j=0;j