Skip to content

Commit

Permalink
Merge pull request #267 from amit777/development
Browse files Browse the repository at this point in the history
Making pull request again development branch
  • Loading branch information
nraboy authored Jul 11, 2016
2 parents 1b567b0 + f1a4af2 commit afce368
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 35 deletions.
27 changes: 11 additions & 16 deletions dist/ng-cordova-oauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@
browserRef.addEventListener("loadstart", function(event) {
if((event.url).indexOf('http://localhost/callback') === 0) {
var requestToken = (event.url).split("code=")[1];
$http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
$http({method: "post", url: adfsServer + "/adfs/oauth2/token", data: "client_id=" + clientId + "&code=" + requestToken + "&redirect_uri=http://localhost/callback&grant_type=authorization_code" })
$http({method: "post", headers: {'Content-Type': 'application/x-www-form-urlencoded'}, url: adfsServer + "/adfs/oauth2/token", data: "client_id=" + clientId + "&code=" + requestToken + "&redirect_uri=http://localhost/callback&grant_type=authorization_code" })
.success(function(data) {
deferred.resolve(data);
})
Expand Down Expand Up @@ -134,9 +133,8 @@
if((event.url).indexOf('http://localhost/callback') === 0) {
var requestToken = (event.url).split("code=")[1];
console.log(requestToken);
$http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';

$http({method: "post", url: "https://login.microsoftonline.com/" + tenantId + "/oauth2/token", data:
$http({method: "post", headers: {'Content-Type': 'application/x-www-form-urlencoded'}, url: "https://login.microsoftonline.com/" + tenantId + "/oauth2/token", data:
"client_id=" + clientId +
"&code=" + requestToken +
"&redirect_uri=http://localhost/callback&" +
Expand Down Expand Up @@ -203,8 +201,8 @@
browserRef.addEventListener('loadstart', function(event) {
if((event.url).indexOf(redirect_uri) === 0) {
var requestToken = (event.url).split("code=")[1];
$http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
$http({method: "post", url: "https://app.box.com/api/oauth2/token", data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&redirect_uri=" + redirect_uri + "&grant_type=authorization_code" + "&code=" + requestToken })

$http({method: "post", headers: {'Content-Type': 'application/x-www-form-urlencoded'}, url: "https://app.box.com/api/oauth2/token", data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&redirect_uri=" + redirect_uri + "&grant_type=authorization_code" + "&code=" + requestToken })
.success(function(data) {
deferred.resolve(data);
})
Expand Down Expand Up @@ -266,8 +264,8 @@
browserRef.addEventListener("loadstart", function(event) {
if((event.url).indexOf(redirect_uri) === 0) {
var requestToken = (event.url).split("code=")[1];
$http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
$http({method: "post", url: "https://cloud.digitalocean.com/v1/oauth/token", data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&redirect_uri=" + redirect_uri + "&grant_type=authorization_code" + "&code=" + requestToken })

$http({method: "post", headers: {'Content-Type': 'application/x-www-form-urlencoded'}, url: "https://cloud.digitalocean.com/v1/oauth/token", data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&redirect_uri=" + redirect_uri + "&grant_type=authorization_code" + "&code=" + requestToken })
.success(function(data) {
deferred.resolve(data);
})
Expand Down Expand Up @@ -341,9 +339,10 @@
if ((event.url).indexOf(redirect_uri) === 0) {
var callBackCode = (event.url).split("code=")[1];
var code = callBackCode.split("&")[0];
$http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';

$http({
method: "post",
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
url: ACCESS_TOKEN_URL,
data: "client_id=" + clientId + "&redirect_uri=" + redirect_uri + "&client_secret=" + clientSecret + "&code=" + code
})
Expand Down Expand Up @@ -597,8 +596,7 @@
browserRef.addEventListener("loadstart", function(event) {
if((event.url).indexOf(redirect_uri) === 0) {
var requestToken = (event.url).split("code=")[1];
$http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
$http({method: "post", url: "https://ident.familysearch.org/cis-web/oauth2/v3/token", data: "client_id=" + clientId + "&redirect_uri=" + redirect_uri + "&grant_type=authorization_code&code=" + requestToken })
$http({method: "post", headers: {'Content-Type': 'application/x-www-form-urlencoded'}, url: "https://ident.familysearch.org/cis-web/oauth2/v3/token", data: "client_id=" + clientId + "&redirect_uri=" + redirect_uri + "&grant_type=authorization_code&code=" + requestToken })
.success(function(data) {
deferred.resolve(data);
})
Expand Down Expand Up @@ -728,9 +726,7 @@
browserRef.addEventListener('loadstart', function(event) {
if((event.url).indexOf(redirect_uri) === 0) {
var requestToken = (event.url).split("code=")[1];
$http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
$http.defaults.headers.post.accept = 'application/json';
$http({method: "post", url: "https://github.com/login/oauth/access_token", data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&redirect_uri=" + redirect_uri + "&code=" + requestToken })
$http({method: "post", headers: {'Content-Type': 'application/x-www-form-urlencoded', 'accept': 'application/json'}, url: "https://github.com/login/oauth/access_token", data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&redirect_uri=" + redirect_uri + "&code=" + requestToken })
.success(function(data) {
deferred.resolve(data);
})
Expand Down Expand Up @@ -992,8 +988,7 @@
if((event.url).indexOf(redirect_uri) === 0) {
var requestToken = (event.url).split("code=")[1];

$http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
$http({method: "post", url: "https://jawbone.com/auth/oauth2/token", data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&grant_type=authorization_code&code=" + requestToken })
$http({method: "post", headers: {'Content-Type': 'application/x-www-form-urlencoded'}, url: "https://jawbone.com/auth/oauth2/token", data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&grant_type=authorization_code&code=" + requestToken })
.success(function(data) {
deferred.resolve(data);
})
Expand Down
6 changes: 3 additions & 3 deletions dist/ng-cordova-oauth.min.js

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions src/oauth.adfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
browserRef.addEventListener("loadstart", function(event) {
if((event.url).indexOf('http://localhost/callback') === 0) {
var requestToken = (event.url).split("code=")[1];
$http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
$http({method: "post", url: adfsServer + "/adfs/oauth2/token", data: "client_id=" + clientId + "&code=" + requestToken + "&redirect_uri=http://localhost/callback&grant_type=authorization_code" })
$http({method: "post", headers: {'Content-Type': 'application/x-www-form-urlencoded'}, url: adfsServer + "/adfs/oauth2/token", data: "client_id=" + clientId + "&code=" + requestToken + "&redirect_uri=http://localhost/callback&grant_type=authorization_code" })
.success(function(data) {
deferred.resolve(data);
})
Expand Down
3 changes: 1 addition & 2 deletions src/oauth.azuread.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@
if((event.url).indexOf('http://localhost/callback') === 0) {
var requestToken = (event.url).split("code=")[1];
console.log(requestToken);
$http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';

$http({method: "post", url: "https://login.microsoftonline.com/" + tenantId + "/oauth2/token", data:
$http({method: "post", headers: {'Content-Type': 'application/x-www-form-urlencoded'}, url: "https://login.microsoftonline.com/" + tenantId + "/oauth2/token", data:
"client_id=" + clientId +
"&code=" + requestToken +
"&redirect_uri=http://localhost/callback&" +
Expand Down
4 changes: 2 additions & 2 deletions src/oauth.box.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
browserRef.addEventListener('loadstart', function(event) {
if((event.url).indexOf(redirect_uri) === 0) {
var requestToken = (event.url).split("code=")[1];
$http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
$http({method: "post", url: "https://app.box.com/api/oauth2/token", data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&redirect_uri=" + redirect_uri + "&grant_type=authorization_code" + "&code=" + requestToken })

$http({method: "post", headers: {'Content-Type': 'application/x-www-form-urlencoded'}, url: "https://app.box.com/api/oauth2/token", data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&redirect_uri=" + redirect_uri + "&grant_type=authorization_code" + "&code=" + requestToken })
.success(function(data) {
deferred.resolve(data);
})
Expand Down
4 changes: 2 additions & 2 deletions src/oauth.digitalOcean.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
browserRef.addEventListener("loadstart", function(event) {
if((event.url).indexOf(redirect_uri) === 0) {
var requestToken = (event.url).split("code=")[1];
$http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
$http({method: "post", url: "https://cloud.digitalocean.com/v1/oauth/token", data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&redirect_uri=" + redirect_uri + "&grant_type=authorization_code" + "&code=" + requestToken })

$http({method: "post", headers: {'Content-Type': 'application/x-www-form-urlencoded'}, url: "https://cloud.digitalocean.com/v1/oauth/token", data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&redirect_uri=" + redirect_uri + "&grant_type=authorization_code" + "&code=" + requestToken })
.success(function(data) {
deferred.resolve(data);
})
Expand Down
3 changes: 2 additions & 1 deletion src/oauth.dribble.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@
if ((event.url).indexOf(redirect_uri) === 0) {
var callBackCode = (event.url).split("code=")[1];
var code = callBackCode.split("&")[0];
$http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';

$http({
method: "post",
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
url: ACCESS_TOKEN_URL,
data: "client_id=" + clientId + "&redirect_uri=" + redirect_uri + "&client_secret=" + clientSecret + "&code=" + code
})
Expand Down
3 changes: 1 addition & 2 deletions src/oauth.familySearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
browserRef.addEventListener("loadstart", function(event) {
if((event.url).indexOf(redirect_uri) === 0) {
var requestToken = (event.url).split("code=")[1];
$http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
$http({method: "post", url: "https://ident.familysearch.org/cis-web/oauth2/v3/token", data: "client_id=" + clientId + "&redirect_uri=" + redirect_uri + "&grant_type=authorization_code&code=" + requestToken })
$http({method: "post", headers: {'Content-Type': 'application/x-www-form-urlencoded'}, url: "https://ident.familysearch.org/cis-web/oauth2/v3/token", data: "client_id=" + clientId + "&redirect_uri=" + redirect_uri + "&grant_type=authorization_code&code=" + requestToken })
.success(function(data) {
deferred.resolve(data);
})
Expand Down
4 changes: 1 addition & 3 deletions src/oauth.github.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@
browserRef.addEventListener('loadstart', function(event) {
if((event.url).indexOf(redirect_uri) === 0) {
var requestToken = (event.url).split("code=")[1];
$http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
$http.defaults.headers.post.accept = 'application/json';
$http({method: "post", url: "https://github.com/login/oauth/access_token", data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&redirect_uri=" + redirect_uri + "&code=" + requestToken })
$http({method: "post", headers: {'Content-Type': 'application/x-www-form-urlencoded', 'accept': 'application/json'}, url: "https://github.com/login/oauth/access_token", data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&redirect_uri=" + redirect_uri + "&code=" + requestToken })
.success(function(data) {
deferred.resolve(data);
})
Expand Down
3 changes: 1 addition & 2 deletions src/oauth.jawbone.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
if((event.url).indexOf(redirect_uri) === 0) {
var requestToken = (event.url).split("code=")[1];

$http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
$http({method: "post", url: "https://jawbone.com/auth/oauth2/token", data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&grant_type=authorization_code&code=" + requestToken })
$http({method: "post", headers: {'Content-Type': 'application/x-www-form-urlencoded'}, url: "https://jawbone.com/auth/oauth2/token", data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&grant_type=authorization_code&code=" + requestToken })
.success(function(data) {
deferred.resolve(data);
})
Expand Down

0 comments on commit afce368

Please sign in to comment.