Hi
Thanks so much for sharing. However, we still need the source from this Angular package:
@volosoft/abp.ng.theme.lepton-x
How/where can we get that source (i.e. unpackaged)? Is it on the Volosoft github? We didn't see it on the ABP github.
Thanks!
HI,
BTW, ABP will try to get the token from the cache; it won't get a new token every time. https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelAuthenticationService.cs#L84
Hi,
The whole point is it's not picking it from cache and generating the new one on every request. I hit the service continueously and you can see the tokens are generated for each request.
I see this tokens are even loaded in my cache but the Payload is null.
Hi liangshiwei,
Here is the code.
VendorModule:
public interface IVendorIntegrationService : IApplicationService, ITransientDependency
{
Task<ListResultDto<VendorDto>> GetAllAsync();
}
[Authorize(VendorManagementPermissions.Vendors.Default)]
[IntegrationService]
public class VendorIntegrationService : ApplicationService,IVendorIntegrationService
{
private readonly VendorManager _vendorManager;
private readonly IRepository<Vendor, int> _vendorRepository;
public VendorIntegrationService(VendorManager vendorManager, IRepository<Vendor, int> vendorRepository)
{
_vendorManager = vendorManager;
_vendorRepository = vendorRepository;
}
[Authorize(VendorManagementPermissions.Vendors.Default)]
public async Task<ListResultDto<VendorDto>> GetAllAsync()
{
var vendors = await _vendorRepository.GetListAsync();
return new ListResultDto<VendorDto>(
ObjectMapper.Map<List<Vendor>, List<VendorDto>>(vendors)
);
}
}
[IntegrationService]
public class VendorIntegrationController:IVendorIntegrationService
{
private readonly IVendorIntegrationService _vendorIntegrationService;
public VendorIntegrationController(IVendorIntegrationService vendorIntegrationService)
{
_vendorIntegrationService = vendorIntegrationService;
}
public Task<ListResultDto<VendorDto>> GetAllAsync()
{
return _vendorIntegrationService.GetAllAsync();
}
}
VendorManagementApplicationModule:AbpModule
private void ConfigureIntegrationServices()
{
Configure<AbpAspNetCoreMvcOptions>(options =>
{
options.ExposeIntegrationServices = true;
});
}
If I'm trying to access this from web-gateway I get 404 not found exception but same works from Vendor service swagger.
10/3/2024 11:18:38 PM [Information] Request starting "HTTP/1.1" "GET" "http"://"localhost:44397""""/integration-api/vendorservice/vendor""" - null null 10/3/2024 11:18:38 PM [Information] Request finished "HTTP/1.1" "GET" "http"://"localhost:44397""""/integration-api/vendorservice/vendor""" - 404 0 null 1.6004ms 10/3/2024 11:18:38 PM [Information] Request reached the end of the middleware pipeline without being handled by application code. Request path: "GET" "http"://"localhost:44397""""/integration-api/vendorservice/vendor", Response status code: 404
Accounts Payable Module:
private readonly IVendorAppService _vendorAppService;
private readonly IVendorIntegrationService _vendorIntegrationService;
public SampleAppService(IVendorAppService vendorAppService, IVendorIntegrationService vendorIntegrationService)
{
_vendorAppService = vendorAppService;
_vendorIntegrationService = vendorIntegrationService;
}
public async Task<ListResultDto<VendorDto>> GetVendorFromAPIntegration()
{
return await _vendorIntegrationService.GetAllAsync();
}
From Accounts payable when I make request first I got 404 so I added Remoteservice configuration in appsettings.json as below.
"RemoteServices": {
"AbpIdentity": {
"BaseUrl": "http://localhost:44377/"
},
"Default": { //This is the URL of web-gateway. Which will be used to call other services(Vendor Service).
"BaseUrl": "http://localhost:44397/",
"UseCurrentAccessToken": "false"
},
"VendorService": {
"BaseUrl": "http://localhost:44323/",
"RemoteName": "VendorService",
"UseCurrentAccessToken": "true"
}
},
After adding this I started getting 401 unauthorized.
10/3/2024 11:25:08 PM [Information] Request starting "HTTP/1.1" "GET" "http"://"localhost:44305""""/api/ap-management/sample/vendor-from-aPIntegration""" - null null 10/3/2024 11:25:09 PM [Information] Executing endpoint '"CastandCrew.PSL.AccountsPayableManagement.Samples.SampleController.GetVendorFromAPIntegration (CastandCrew.PSL.AccountsPayableManagement.HttpApi)"' 10/3/2024 11:25:09 PM [Information] Route matched with "{area = \"accountsPayableManagement\", action = \"GetVendorFromAPIntegration\", controller = \"Sample\", page = \"\"}". Executing controller action with signature "System.Threading.Tasks.Task
1[Volo.Abp.Application.Dtos.ListResultDto`1[CastandCrew.PSL.VendorManagement.Vendor.VendorDto]] GetVendorFromAPIntegration()" on controller "CastandCrew.PSL.AccountsPayableManagement.Samples.SampleController" ("CastandCrew.PSL.AccountsPayableManagement.HttpApi").
10/3/2024 11:25:09 PM [Warning] Could not find IdentityClientConfiguration for VendorService. Either define a configuration for VendorService or set a default configuration.
10/3/2024 11:25:09 PM [Information] Start processing HTTP request "GET" "http://localhost:44323/integration-api/vendorservice/vendor?api-version=1.0"
10/3/2024 11:25:09 PM [Information] Sending HTTP request "GET" "http://localhost:44323/integration-api/vendorservice/vendor?api-version=1.0"
10/3/2024 11:25:09 PM [Information] Received HTTP response headers after 26.7839ms - 401
10/3/2024 11:25:09 PM [Information] End processing HTTP request after 27.3146ms - 401
10/3/2024 11:25:09 PM [Error] ---------- RemoteServiceErrorInfo ----------
{
"code": "Unauthorized",
"message": "Unauthorized",
"details": null,
"data": null,
"validationErrors": null
}
10/3/2024 11:25:09 PM [Error] Volo.Abp.Http.Client.AbpRemoteCallException: Unauthorized
at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.ThrowExceptionForResponseAsync(HttpResponseMessage response) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase
1.RequestAsync(ClientProxyRequestContext requestContext)
at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync[T](ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptorClientProxy
1.CallRequestAsync[T](ClientProxyRequestContext requestContext)
at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.CallRequestAsync[T](ClientProxyRequestContext context) at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor
1.GetResultAsync(Task task, Type resultType)
at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter
1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue
1.ProceedAsync()
at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed)
at CastandCrew.PSL.AccountsPayableManagement.Samples.SampleAppService.GetVendorFromAPIntegration() in D:\PROJECTS\PSLWEB2\psl-modules\CastandCrew.PSL.AccountsPayableManagement\src\CastandCrew.PSL.AccountsPayableManagement.Application\Samples\SampleAppService.cs:line 23
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.GlobalFeatures.GlobalFeatureInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter
1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue
1.ProceedAsync()
at Volo.Abp.Auditing.AuditingInterceptor.ProceedByLoggingAsync(IAbpMethodInvocation invocation, AbpAuditingOptions options, IAuditingHelper auditingHelper, IAuditLogScope auditLogScope)
at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Authorization.AuthorizationInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter
1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue
1.ProceedAsync()
at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter
1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at CastandCrew.PSL.AccountsPayableManagement.Samples.SampleController.GetVendorFromAPIntegration() in D:\PROJECTS\PSLWEB2\psl-modules\CastandCrew.PSL.AccountsPayableManagement\src\CastandCrew.PSL.AccountsPayableManagement.HttpApi\Samples\SampleController.cs:line 44 at lambda_method1762(Closure, Object) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask
1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.
10/3/2024 11:25:09 PM [Error] Code:Unauthorized 10/3/2024 11:25:09 PM [Error] Details: 10/3/2024 11:25:09 PM [Information] Executing "ObjectResult", writing value of type '"Volo.Abp.Http.RemoteServiceErrorResponse"'. 10/3/2024 11:25:09 PM [Information] Executed action "CastandCrew.PSL.AccountsPayableManagement.Samples.SampleController.GetVendorFromAPIntegration (CastandCrew.PSL.AccountsPayableManagement.HttpApi)" in 44.5462ms 10/3/2024 11:25:09 PM [Information] Executed endpoint '"CastandCrew.PSL.AccountsPayableManagement.Samples.SampleController.GetVendorFromAPIntegration (CastandCrew.PSL.AccountsPayableManagement.HttpApi)"' 10/3/2024 11:25:09 PM [Information] AUDIT LOG: [401: GET ] /api/ap-management/sample/vendor-from-aPIntegration
10/3/2024 11:25:09 PM [Information] Request finished "HTTP/1.1" "GET" "http"://"localhost:44305""""/api/ap-management/sample/vendor-from-aPIntegration""" - 401 null "application/json; charset=utf-8" 84.3498ms
`
Hi liangshiwei,
Thanks for the quick reply. If I moved to Integration Service do I still need aa access_token while communication from service to service? When I followed intergration implemntation I gets UnAuthorized exception.
Thanks Krishna
I've implemented microservice to microservice synchronous communication as stated here. The soulution works just fine. I'm able to get data from cross service but every time I hit the endpoint on other service I see a new token is generated and it is causing my OpenIddictTokens just keeps increasing. Can't the once generated token be re-used again for next service call? I see the token is generated with 1 hour of expiration but next service call(Same endpoint) does not consider existing token and generates the new token.
Thanks Krishna
Hi,
Can we please get some resolution on this? We have been blocked for almost a week, waiting on this to get resolved.
Thanks!
hi! yes, i have confirmed that i logged into the CLI:
% abp login-info [15:33:05 INF] You are running the second generation of the ABP CLI. If you're interested in the legacy CLI, see https://abp.io/new-cli [15:33:18 INF] Login info: Name: Surname: Username: sgarad
tried to run the "abp get-source Volo.Abp.LeptonXTheme" command again, and got some new warnings in addition to the same error:
% abp get-source Volo.Abp.LeptonXTheme
[15:34:27 INF] You are running the second generation of the ABP CLI. If you're interested in the legacy CLI, see https://abp.io/new-cli
[15:34:27 INF] Downloading source code of Volo.Abp.LeptonXTheme (Latest)
[15:34:27 INF] Output folder: /Users/lsuh/Projects/temp/abp
[15:34:35 WRN] Failed to get global nuget source: https://nuget.abp.io/<myLicenseKey>/v3/index.json
[15:35:27 ERR] Downloading source code failed for: Volo.Abp.LeptonXTheme
Volo.Abp.Studio.AbpStudioException: Exception of type
'Volo.Abp.Studio.AbpStudioException' was thrown.
at async Task Volo.Abp.Studio.Modules.Installing.SourceCodeDownloader.
DownloadSourceCodeAsync(string moduleName, string targetFolder, string
version, bool includeNightly)
at async Task Volo.Abp.Studio.Cli.Commands.StudioGetSourceCommand.ExecuteAsync(
CommandLineArgs commandLineArgs)
at async Task Volo.Abp.Studio.Cli.StudioCliService.RunInternalAsync(
CommandLineArgs commandLineArgs)
at async Task Volo.Abp.Studio.Cli.StudioCliService.RunAsync(string[] args)
Both my ABP Studio and CLI are at version 0.8.3. Same result.
What exactly is it that throws that exception?
% abp get-source Volo.Abp.LeptonXTheme
[20:05:21 INF] You are running the second generation of the ABP CLI. If you're interested in the legacy CLI, see https://abp.io/new-cli
[20:05:21 INF] Downloading source code of Volo.Abp.LeptonXTheme (Latest)
[20:05:21 INF] Output folder: /Users/lsuh/Projects/temp/abp
[20:06:21 ERR] Downloading source code failed for: Volo.Abp.LeptonXTheme
Volo.Abp.Studio.AbpStudioException: Exception of type
'Volo.Abp.Studio.AbpStudioException' was thrown.
at async Task Volo.Abp.Studio.Modules.Installing.SourceCodeDownloader.
DownloadSourceCodeAsync(string moduleName, string targetFolder, string
version, bool includeNightly)
at async Task Volo.Abp.Studio.Cli.Commands.StudioGetSourceCommand.ExecuteAsync
(CommandLineArgs commandLineArgs)
at async Task Volo.Abp.Studio.Cli.StudioCliService.RunInternalAsync(
CommandLineArgs commandLineArgs)
at async Task Volo.Abp.Studio.Cli.StudioCliService.RunAsync(string[] args)
ABP Framework version: v8.2.x
UI Type: Angular
Database System: EF Core (MySQL)
Auth Server Separated (for Angular): yes
Exception message and full stack trace:
[16:57:31 INF] You are running the second generation of the ABP CLI. If you're interested in the legacy CLI, see https://abp.io/new-cli
[16:57:31 INF] Downloading source code of Volo.Abp.LeptonXTheme (Latest)
[16:57:31 INF] Output folder: /Users/lsuh/Projects/temp/abp
[16:57:49 ERR] Downloading source code failed for: Volo.Abp.LeptonXTheme
Volo.Abp.Studio.AbpStudioException: Exception of type
'Volo.Abp.Studio.AbpStudioException' was thrown.
at async Task Volo.Abp.Studio.Modules.Installing.SourceCodeDownloader.
DownloadSourceCodeAsync(string moduleName, string targetFolder, string
version, bool includeNightly)
at async Task Volo.Abp.Studio.Cli.Commands.StudioGetSourceCommand.ExecuteAsync(
CommandLineArgs commandLineArgs)
at async Task Volo.Abp.Studio.Cli.StudioCliService.RunInternalAsync(
CommandLineArgs commandLineArgs)
at async Task Volo.Abp.Studio.Cli.StudioCliService.RunAsync(string[] args)
Steps to reproduce the issue: Run the following command: abp get-source Volo.Abp.LeptonXTheme