Hurry Up, Ends March 14!
Open Closed

Authorization for gRPC calls on microservices #8581


User avatar
0
r.abouzid created
  • Template: microservice
  • Created ABP Studio Version: 0.9.5
  • UI Framework: angular
  • Theme: leptonx
  • Theme Style: system
  • Database Provider: ef
  • Database Management System: sqlserver
  • Mobile Framework: maui
  • Public Website: Yes
  • Exception message and full stack trace: 401 : Unauthorized
  • Steps to reproduce the issue: following this article : https://abp.io/docs/commercial/latest/startup-templates/microservice/using-grpc#contributors-section

Hello, I'm working on a project based on the microservices' template, when I implement the gRPC for the inter services communication, the authorization : [Authorize(IdentityPermissions.Users.Create)] blocks me when I call the service from the client µS, 401, Unauthorized. How can I solve this problem with best practices ?


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

    hi

    Have you added the Authorization header with Bearer {access_token} for your request?

    Please share your code using grpc

    Thanks.

  • User Avatar
    0
    r.abouzid created

    I want to bypass the authorization for all the calls via gRPC, from the µservices, and keep the authorization for the external calls coming from the Gateway.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    For internal calls between microservices, you can use integration-services, which does not require authorization.

    For application services you have to pass authorization state(token)

    https://abp.io/docs/latest/framework/api-development/integration-services https://abp.io/docs/latest/tutorials/modular-crm/part-06

  • User Avatar
    0
    r.abouzid created

    Hello, I tried using Integration Services, i no longer get the authorization error. However, the client, after receiving the gRPC response, raises the exception :

    Grpc.Core.RpcException
      HResult=0x80131500
      Message=Status(StatusCode="Internal", Detail="Failed to deserialize response message. The response header contains a gRPC status of OK, which means any message returned to the client for this call should be ignored. A unary or client streaming gRPC call must have a response message, which makes this response invalid.")
    
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share a test project to reproduce this error?

    liming.ma@volosoft.com Thanks

Learn More, Pay Less
33% OFF
All Trainings!
Get Your Deal
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.2.0-preview. Updated on March 05, 2025, 10:55