Skip to content

documentation for config updater #56

@dmilisic

Description

@dmilisic

Hi,

I found this module very useful for my usecase. However, I had issue with Authorization header not being updated. It had been sending the same header again and again. The code (after token refresh) was the following:

$http.defaults.headers.common['Authorization'] = 'Token token="' + newToken + '"';
authService.loginConfirmed();

but that didn't update the Authorization header for retried requests. After digging around for a couple of hours, I found out that the loginConfirmed method had second argument named configUpdater. I solved the problem by using it:

$http.defaults.headers.common['Authorization'] = 'Token token="' + newToken + '"';
authService.loginConfirmed(null, function(config) {
    config.headers['Authorization'] = 'Token token="' + newToken + '"';
    return config;
});

I hope this could save someone else's time, and it would be great if you could add some documentation for configUpdater.

Thanks,
Danijel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions