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

Autorization on Azure Ad failled #93

Open
infosam1976 opened this issue Sep 6, 2023 · 0 comments
Open

Autorization on Azure Ad failled #93

infosam1976 opened this issue Sep 6, 2023 · 0 comments

Comments

@infosam1976
Copy link

I have deploy the sample on Ad Azure free for testing and I get an error when call the api with WPF application (also with blazor app with identitifcation)

error : AuthenticationFailed: 'IDX10503: Signature validation failed. Keys tried: 'Microsoft.IdentityModel.Tokens ..

I'm get token with token and I place this one in user call :

private async Task GetToken()
{
HttpClient cli = new HttpClient();

        HttpResponseMessage response = await cli.GetAsync("https://microsoftscimwebtest.azurewebsites.net/scim/Token");

        response.EnsureSuccessStatusCode();

        string token = await response.Content.ReadAsStringAsync();

        JObject obj = JObject.Parse(token);

        return obj.GetValue("token").ToString();
    }

    private  async void Button_Click(object sender, RoutedEventArgs e)
    {
        var token = await GetToken();

        using (var client = new HttpClient())
        {
            //client.DefaultRequestHeaders.Add("Authorization", $"Bearer {token}");

            // await client.GetAsync("https://microsoftscimwebtest.azurewebsites.net/scim/Users?attributes=userName");
            var result = await client.GetAsync("https://microsoftscimwebtest.azurewebsites.net/scim/Groups");

            if (!result.IsSuccessStatusCode)
            {
                throw new ArgumentException("error");
            }

            var jsonResult = await result.Content.ReadAsStringAsync();
        }
    }

Tank's for you help

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