Open Closed

Call ABP Api from Angular #611


User avatar
0
shobhit created

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: v3.3.0
  • UI type: Angular
  • Tiered (MVC) or Identity Server Seperated (Angular): yes
  • Exception message and stack trace: NA
  • Steps to reproduce the issue: NA

How to call the ABP APi from postman or angular UI, considering we got authentication token from identity server. Please find the attached postman screen shot.

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

3 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    There is no problem with passing the token using the Authorization request header. Authorization: Bearer token

    Authorization failed! Give policy has not grandted

    You can check the application's log to see the details.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    shobhit created

    Logs from Identity server:

    2020-12-01 09:03:14.340 +00:00 [WRN] Ldap login feature is not enabled!
    2020-12-01 09:03:14.573 +00:00 [INF] Credentials validated for username: User
    2020-12-01 09:03:14.574 +00:00 [INF] {"Username":"User","Provider":null,"ProviderUserId":null,"SubjectId":"097accbe-590c-688a-1055-39f82dfb3f7d","DisplayName":"User","Endpoint":"Token","ClientId":null,"Category":"Authentication","Name":"User Login Success","EventType":"Success","Id":1000,"Message":null,"ActivityId":"80000002-0002-fe00-b63f-84710c7967bb","TimeStamp":"2020-12-01T09:03:14.0000000Z","ProcessId":5452,"LocalIpAddress":"10.0.0.4:44388","RemoteIpAddress":"103.252.169.100","$type":"UserLoginSuccessEvent"}
    2020-12-01 09:03:15.057 +00:00 [INF] {"Username":"User","Provider":null,"ProviderUserId":null,"SubjectId":"097accbe-590c-688a-1055-39f82dfb3f7d","DisplayName":null,"Endpoint":"Token","ClientId":"trial_App","Category":"Authentication","Name":"User Login Success","EventType":"Success","Id":1000,"Message":null,"ActivityId":"80000002-0002-fe00-b63f-84710c7967bb","TimeStamp":"2020-12-01T09:03:15.0000000Z","ProcessId":5452,"LocalIpAddress":"10.0.0.4:44388","RemoteIpAddress":"103.252.169.100","$type":"UserLoginSuccessEvent"}
    2020-12-01 09:03:15.063 +00:00 [INF] Token request validation success, {"ClientId":"trial_App","ClientName":"trial_App","GrantType":"password","Scopes":"trial offline_access","AuthorizationCode":null,"RefreshToken":null,"UserName":"User","AuthenticationContextReferenceClasses":null,"Tenant":null,"IdP":null,"Raw":{"scope":"trial offline_access","grant_type":"password","username":"User","password":"***REDACTED***","client_id":"trial_App","client_secret":"***REDACTED***"},"$type":"TokenRequestValidationLog"}
    2020-12-01 09:03:15.356 +00:00 [INF] {"ClientId":"trial_App","ClientName":"trial_App","RedirectUri":null,"Endpoint":"Token","SubjectId":"097accbe-590c-688a-1055-39f82dfb3f7d","Scopes":"trial offline_access","GrantType":"password","Tokens":[{"TokenType":"refresh_token","TokenValue":"****Z3AY","$type":"Token"},{"TokenType":"access_token","TokenValue":"****mujg","$type":"Token"}],"Category":"Token","Name":"Token Issued Success","EventType":"Success","Id":2000,"Message":null,"ActivityId":"80000002-0002-fe00-b63f-84710c7967bb","TimeStamp":"2020-12-01T09:03:15.0000000Z","ProcessId":5452,"LocalIpAddress":"10.0.0.4:44388","RemoteIpAddress":"103.252.169.100","$type":"TokenIssuedSuccessEvent"}
    2020-12-01 09:03:15.378 +00:00 [INF] Request finished in 5761.7416ms 200 application/json; charset=UTF-8
    2020-12-01 09:04:12.923 +00:00 [INF] Request starting HTTP/1.1 GET https://Identityserverurl:44388/api/identity/my-profile  
    2020-12-01 09:04:12.944 +00:00 [INF] Executing endpoint 'Volo.Abp.Identity.ProfileController.GetAsync (Volo.Abp.Identity.Pro.HttpApi)'
    2020-12-01 09:04:13.016 +00:00 [INF] Route matched with {area = "identity", controller = "Profile", action = "Get", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Volo.Abp.Identity.ProfileDto] GetAsync() on controller Volo.Abp.Identity.ProfileController (Volo.Abp.Identity.Pro.HttpApi).
    2020-12-01 09:04:13.103 +00:00 [INF] Authorization failed.
    2020-12-01 09:04:13.117 +00:00 [WRN] ---------- RemoteServiceErrorInfo ----------
    {
      "code": null,
      "message": "Authorization failed! Given policy has not granted.",
      "details": null,
      "data": null,
      "validationErrors": null
    }
    
    2020-12-01 09:04:13.117 +00:00 [WRN] Authorization failed! Given policy has not granted.
    Volo.Abp.Authorization.AbpAuthorizationException: Authorization failed! Given policy has not granted.
       at Microsoft.AspNetCore.Authorization.AbpAuthorizationServiceExtensions.CheckAsync(IAuthorizationService authorizationService, AuthorizationPolicy policy)
       at Volo.Abp.Authorization.MethodInvocationAuthorizationService.CheckAsync(MethodInvocationAuthorizationContext context)
       at Volo.Abp.Authorization.AuthorizationInterceptor.AuthorizeAsync(IAbpMethodInvocation invocation)
       at Volo.Abp.Authorization.AuthorizationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
       at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 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.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
       at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
       at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
       at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
       at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
       at lambda_method(Closure , Object )
       at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
       at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(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.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
    --- End of stack trace from previous location where exception was thrown ---
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
    2020-12-01 09:04:13.155 +00:00 [INF] Executing ObjectResult, writing value of type Volo.Abp.Http.RemoteServiceErrorResponse
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi @shobhit

    Can I check remotely? liming.ma@volosoft.com

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on October 05, 2026, 11:32
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.