-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What If my api doesn't use .data #12
Comments
@amrnt - good question. I think the cleanest solution will be to provide a configurable method that returns authentication data from the API response. Something like this: angular.module('myApp', ['ng-token-auth'])
.config(function($authProvider) {
$authProvider.configure({
apiUrl: 'http://api.example.com'
handleAuthResponse: function(response) {
// this would be the default
return response.data;
// or if you don't use the data param, just return the response itself
return response;
});
});
}); Would this be acceptable? |
@lynndylanhurley Yes! This would be just fine! |
Cool, I'll have this ready within the next day or so. |
It works great! Thank you 😃 Tho, for the last release, Bower is complaining about the version |
Must be a typo in the bower.json file 😵. I'll push a proper release tomorrow! |
In your code when sign in you return data of
resp.data
. My API returned object doesn't havedata
attr. And it would be a night mare (somehow) to implement it. Temporarily, I'm hacking your code to make it works with me.As well as this method: https://github.com/lynndylanhurley/ng-token-auth/blob/master/src/ng-token-auth.coffee#L87
The text was updated successfully, but these errors were encountered: