无法使用this.adalService.acquireToken

时间:2018-01-06 11:54:31

标签: angular azure asp.net-web-api

我正在使用ng2-adal进行Azure AD身份验证。我创建了2个项目,一个是Angular 2和WebAPI。使用ng2-adal,我能够验证用户并获得Web App访问令牌,但是要获取Web API的访问令牌,我使用下面的代码

public getToken(): any {
        debugger;
        return this.adalService.acquireToken("d3ff1be3-8484-4b28-8b67-7df715a5af79").subscribe(
            token => {
                console.log(token.toString());
            },
            error =>
            {
                console.log(error);
            }
        );
    }

当我在开发人员工具中看到时,使用此代码我将获得访问代码。请找到附件,但我没有进入令牌变量,没有进入订阅回调函数。请告诉我有没有办法使用ng2-adal获取Web API的访问令牌。

enter image description here

谢谢, Raj4MS

0 个答案:

没有答案