Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Commit

Permalink
Use oauth module from PJC
Browse files Browse the repository at this point in the history
  • Loading branch information
itsravenous committed Sep 1, 2016
1 parent 6bee11f commit decff8a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
14 changes: 4 additions & 10 deletions app/modules/auth/scripts/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,14 @@
_setToken(params.access_token);
_startTimer();
return _setUserData()
.then(function () {
$window.location.href = localStorageService.get('redirectOnSignIn');
});
// .then(function () {
// $window.location.href = localStorageService.get('redirectOnSignIn');
// });
}

function signIn() {
localStorageService.set('redirectOnSignIn', $location.absUrl());
$window.location.href = zooAPI.root.match(/^(.*)\/[^/]*$/)[1] +
'/oauth/authorize' +
'?response_type=token' +
'&client_id=' +
zooAPIConfig.app_id +
'&redirect_uri=' +
$location.absUrl().match(/.+?(?=\#\/)/)[0];
$window.zooOAuth.signIn($location.absUrl().match(/.+?(?=\#\/)/)[0]);
}

function _setToken(token) {
Expand Down
3 changes: 1 addition & 2 deletions app/modules/zoo-api/scripts/project-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@

module.factory('zooAPI', function ($window, zooAPIConfig) {
console.log('zooAPIConfig = ', zooAPIConfig);
$window.zooAPI.root = zooAPIConfig.url;
$window.zooAPI.appID = zooAPIConfig.app_id;
$window.zooOAuth.init(zooAPIConfig.app_id);
return $window.zooAPI;
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"karma-firefox-launcher": "^0.1.6",
"karma-jasmine": "0.3.5",
"nib": "1.1.0",
"panoptes-client": "^2.5.1",
"panoptes-client": "^2.5.2",
"run-sequence": "^1.1.0",
"stylus": "^0.51.1"
},
Expand Down
3 changes: 2 additions & 1 deletion panoptes-client-wrapper/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
window.zooAPI = require('panoptes-client/lib/api-client');
window.zooAuth = require('panoptes-client/lib/auth');
window.zooAuth = require('panoptes-client/lib/auth');
window.zooOAuth = require('panoptes-client/lib/oauth');

0 comments on commit decff8a

Please sign in to comment.