ABP Framework Consuming HTTP APIs from a .NET Client
A quick example about consuming the generated HTTP APIs from a .NET client using the proxy system provided by the ABP Framework
A quick example about consuming the generated HTTP APIs from a .NET client using the proxy system provided by the ABP Framework
Comments
Jan Hoefnagels 29 weeks ago
I have just tried to accomplish a connection from the console test app following the instructions in the video but I this error: Volo.Abp.AbpException: Could not get token from the OpenId Connect server! ErrorType: Http. Error: Unauthorized. ErrorDescription: The specified 'client_id' is invalid.. HttpStatusCode: Unauthorized
Pity that this video nor the API client documentation contain any details about how to authorize a client proxy
Bart Van Hoey 23 weeks ago
@Jan Hoefnagels
"BookStore_App": { "ClientId": "BookStore_App", "ClientSecret": "1q2w3e*", "RootUrl": "https://localhost:44333" }
// BookStoreApp Client var bookStoreAppClientId = configurationSection["BookStore_App:ClientId"]; if (!bookStoreAppClientId.IsNullOrWhiteSpace()) { var bookStoreAppRootUrl = configurationSection["BookStore_App:RootUrl"]?.TrimEnd('/'); await CreateApplicationAsync( name: bookStoreAppClientId, type: OpenIddictConstants.ClientTypes.Confidential, consentType: OpenIddictConstants.ConsentTypes.Implicit, displayName: "BookStoreApp", scopes: commonScopes, grantTypes: [ OpenIddictConstants.GrantTypes.Password, ], secret: configurationSection["BookStore_App:ClientSecret"] ?? "1q2w3e*", redirectUri: $"{bookStoreAppRootUrl}/authentication/login-callback" ); }
Run DbMigrator project
Add ClientSecret to BookStore\test\BookStore.HttpApi.Client.ConsoleTestApp\appsettings.json
{ "RemoteServices": { "Default": { "BaseUrl": "https://localhost:44333" } }, "IdentityClients": { "Default": { "GrantType": "password", "ClientId": "BookStore_App", "UserName": "admin", "UserPassword": "1q2w3E*", "ClientSecret": "1q2w3e*", "Authority": "https://localhost:44333", "Scope": "BookStore" } } }
5 Run API and test again
fishergild 1 day ago
This is an awesome video!