Skip to content

Commit

Permalink
$http config is now sent as config to the tokenGetter function.
Browse files Browse the repository at this point in the history
You can do something like:

```js
jwtInterceptorProvider.tokenGetter = function(config) {
  if (config.url.indexOf('http://gonto.com') === 0) {... }
}
```
  • Loading branch information
mgonto committed Oct 6, 2014
1 parent 390f1ea commit e7fa6c0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion dist/angular-jwt.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ angular.module('angular-jwt',
return request;
}

var tokenPromise = $q.when($injector.invoke(config.tokenGetter));
var tokenPromise = $q.when($injector.invoke(config.tokenGetter, this, {
config: request
}));

return tokenPromise.then(function(token) {
if (token) {
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-jwt.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/angularJwt/services/interceptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
return request;
}

var tokenPromise = $q.when($injector.invoke(config.tokenGetter));
var tokenPromise = $q.when($injector.invoke(config.tokenGetter, this, {
config: request
}));

return tokenPromise.then(function(token) {
if (token) {
Expand Down

0 comments on commit e7fa6c0

Please sign in to comment.