Skip to content

How to make all 401 calls again when you get the refreshed token with angular and oauth2

Notifications You must be signed in to change notification settings

DenisaPr/refreshToken

Repository files navigation

refresh-token-exemple

This project is generated with yo angular generator version 0.16.0.

It is just an example that we found.

Description

This project is just an example how we did it, by using angular-oauth2 library and some parts from witoldsz/angular-http-auth.

There are better ways to do it, I am sure this code can be improved, but I wanted to share it, so maybe one day it will help someone.

Main files to see:

app/
    scripts/
        services/
            httpbuffer.js                  - witoldsz lib file
            httpinterceptor.js             - file that checks the call statuses
            user.js                        - file where we treate the refresh token, login and logout
        app.js                             - set the interceptor and the OAuth setup 

Credits

For the lib that we partially used to create what we needed:

witoldsz/angular-http-auth

For the post that helped find this library:

Oauth2 with Angular: The right way - @jeremymarc

About

How to make all 401 calls again when you get the refreshed token with angular and oauth2

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published