Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.
- ABP Framework version: vX.X.X
- UI type: Angular / MVC
- Tiered (MVC) or Identity Server Seperated (Angular): yes / no
- Exception message and stack trace:
- Steps to reproduce the issue:
Hi,
Do you have the demo or sample project for WPF & Xamarin Form to work with ABP ?
Thank you.
3 Answer(s)
-
0
Hi,
We have a WPF template: https://github.com/abpframework/abp/tree/dev/templates/wpf. There is no xamarin project yet . see https://github.com/abpframework/abp/issues/158
-
0
Hi @liangshiwei,
due to some hardware sdk only work on .net framework, I have to comsume the web api in wpf .net framework.
I hit the error for invalid_scope,
Do you have the complete sample code for .net framework to call web api in wpf?
Below is my code to get token and to call web api :-
private async void DoTest() { //discover endpoints from metadata var client = new HttpClient(); var disco = await client.GetDiscoveryDocumentAsync("https://localhost/"); if (disco.IsError) { Console.WriteLine(disco.Error); return; } // request token var tokenResponse = await client.RequestClientCredentialsTokenAsync(new ClientCredentialsTokenRequest { Address = disco.TokenEndpoint, ClientId = "My_App", ClientSecret = "1q2w3e*", Scope = "Myapp" }); if (tokenResponse.IsError) { Console.WriteLine(tokenResponse.Error); return; } Console.WriteLine(tokenResponse.Json); Console.WriteLine("\n\n"); //// call api var apiClient = new HttpClient(); apiClient.SetBearerToken(tokenResponse.AccessToken); var response = await apiClient.GetAsync("https://localhost:443/connect/token"); if (!response.IsSuccessStatusCode) { Console.WriteLine(response.StatusCode); } else { var content = await response.Content.ReadAsStringAsync(); Console.WriteLine(JArray.Parse(content)); } }
-
0
Hi,
invalid_scope
means you are missing some scope or the scope does not exists. check your database make sureMyapp
is exists.invalid_scope
usually has the following reasons:- The scope does not exists , check
IdentityServerApiScopes
database table. - The client does not include this scope, check
IdentityServerClientScopes
database table
- The scope does not exists , check