Azure应用服务IPrincipal的声明必须包含“ iss”声明。

时间:2018-09-18 06:47:05

标签: azure-app-service-plans

我有一个Azure应用服务,该服务有时在以下代码上开始失败。查看日志后,似乎无法使用The IPrincipal's Claims must contain an 'iss' Claim.失败了,我不确定什么已更改或为什么它开始失败。我该如何解决?

[MobileAppController, Authorize]
public class UserInfoController : ApiController
{
    [HttpGet, Route("api/GetUserInfo")]
    public async Task<JToken> Get()
    {
        // fails on this next line
        var msCreds = await User.GetAppServiceIdentityAsync<MicrosoftAccountCredentials>(Request);             var result = new JObject();
        var accessToken = msCreds.AccessToken;
        return await GetProviderInfo("https://apis.live.net/v5.0/me/?method=GET&access_token=" + accessToken);
    }

    async Task<JToken> GetProviderInfo(string url)
    {
        var c = new HttpClient();
        var resp = await c.GetAsync(url);
        resp.EnsureSuccessStatusCode();
        return JToken.Parse(await resp.Content.ReadAsStringAsync());
    }
}

0 个答案:

没有答案