Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Acquire token ( Refresh token ) not working #44

Open
vipins-optimus opened this issue Jun 22, 2018 · 0 comments
Open

[Bug] Acquire token ( Refresh token ) not working #44

vipins-optimus opened this issue Jun 22, 2018 · 0 comments

Comments

@vipins-optimus
Copy link

I have an angular project(version 5.2), and using ADAL service(adal-angular5). After login first time, no error message comes, but when i refresh the browser, the error message comes as =>
github_adal_err

Here is my interceptor code:

    constructor(private adalService: Adal5Service, private loaderService: LoaderService) { }

    addToken(req: HttpRequest<any>, token: string): HttpRequest<any> {
        return req.clone({
            url: environment.apiUrl + req.url,
            headers: req.headers
                .set('Content-Type', 'application/json')
                .set('Authorization', 'Bearer ' + token)
        });
    }

    intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
        this.adalService.acquireToken(environment.adalConfig.resource).subscribe();
        return next.handle(this.addToken(req, this.adalService.userInfo.token))
        .finally(() => this.loaderService.display(false));
    }
@vipins-optimus vipins-optimus changed the title Acquire token ( Refresh token ) not working [Bug] Acquire token ( Refresh token ) not working Jun 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant