Skip to content

[cookbook] Adding http handler for handling backend auth in the background #1819

Open
@ivansieder

Description

@ivansieder

For some applications (which make use of JWTs), we are using fetch and custom Vue instance methods to handle fetch requests and re-authentication in the background, so in case the access token has expired, the application will automatically retry fetching a new access token with the refresh token, if for a request it gets a 401. If that request was successful, it will retry fetching the resource one more time.

There is actually already an awesome cookbook about custom instance properties (https://vuejs.org/v2/cookbook/adding-instance-properties.html), but this one would specifically talk about a $http handler which also takes care of authentication in the background automatically.

Would this be something of interes? If so, I'd love to write something up and create a PR for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions