Skip to content

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

Description

@vipins-optimus

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));
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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