auth0 / angular-jwt

Library to help you work with JWTs on AngularJS
MIT License
0 stars 1 forks source link

Token not added after refresh #164

Closed spardo83 closed 4 years ago

spardo83 commented 7 years ago

After the token has refreshed the api calls in flight end with 401, i´m using $resource to call server. here is my code ` if (options && options.url.substr(options.url.length - 5) == '.html') { return null; }

                var token = authentication.getToken();

                if (token)
                    if (jwtHelper.isTokenExpired(token)) {

                        var refreshToken = authentication.getRefresh();
                        return authentication.refreshToken(refreshToken).then(function (response) {
                            return response;
                        });
                    } else {
                        return token;
                    }`

Te token refresh returns 200 but te subsequent calls made it before the token has been refreshed results in 401. May be i understend wrong but i think the api hangs the api calls and refresh token then make the rest of the calls?

lerzenit commented 6 years ago

Didn't try it but maybe your function to handle authentication.refreshToken() response should return response.data.access_token instead of response.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you have not received a response for our team (apologies for the delay) and this is still a blocker, please reply with additional information or just a ping. Thank you for your contribution! 🙇‍♂️