Skip to content

Updating the Authorization-header #26

Closed
@petervmeijgaard

Description

@petervmeijgaard

So I have a single page application with authorization setup. When the app boots, it will check if the user is authenticated. If not, the user is send to the login page, if so, the app sets the Authorization header of the requests to the token saved in localStorage.
This is working fine, but when I want to login and update the Authorization token, the update isn't reflected and I have to manually refresh the page to make the request with the token.

As you can see here, I set the token correctly:
https://github.com/petervmeijgaard/jwt-example/blob/next/resources/frontend/src/app/store/modules/auth/mutations.js#L24

And even when I do a console.log(Vue.echo.options.auth.headers.Authorization) before I subscribe to a private channel, I get the correct token returned.
However, when I check the request send to the REST-server, the Authorization header isn't set.

The console.log ouput:
The console.log output

The request headers:
The request headers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions