Check out this tutorial on what gRPC is and how you can use it in .NET Core 3.0 to build efficient microservices.
Let us know your thoughts and opinions once you have a chance to go through the article!
I was hoping to see how you would secure a gRPC connection with Auth0. That would make sense to me for an article coming from Auth0. Currently it’s just another tutorial on how to use gRPC.
You are right. This is just a tutorial on using gRPC in .NET Core with the new native support.
Focusing on authentication with gRPC could be the topic of a future article.
Thanks for your contribution.
We’ll let you know @tvdh once we have such article!
I’m trying to secure .NET Core wiht Auth0, but the cord on the blog is not working. Here comes my error when I dotnet run on gRPC service.
Startup.cs(17,40): error CS0103: 現在のコンテキストに ‘Configuration’ という名前は存在しません。 [/Users/hisashiyamaguchi/grpc-dotnet/CreditRatingService/CreditRatingService.csproj]
Startup.cs(20,71): error CS1061: ‘object’ に ‘AuthenticationScheme’ の定義が含まれておらず、型 ‘object’ の最初の引数を受け付けるアクセス可能な拡張メソッド ‘AuthenticationScheme’ が見つかりませんでした。using ディレクティブまたはアセンブリ参照が不足していないことを確認してください。 [/Users/hisashiyamaguchi/grpc-dotnet/CreditRatingService/CreditRatingService.csproj]
Startup.cs(21,68): error CS1061: ‘object’ に ‘AuthenticationScheme’ の定義が含まれておらず、型 ‘object’ の最初の引数を受け付けるアクセス可能な拡張メソッド ‘AuthenticationScheme’ が見つかりませんでした。using ディレクティブまたはアセンブリ参照が不足していないことを確認してください。 [/Users/hisashiyamaguchi/grpc-dotnet/CreditRatingService/CreditRatingService.csproj]
I’m sorry it’s Japanese, but it seems it’s needed to include further packages on gRPC service.
The blog post doesn’t cover the integration of gRPC with Auth0.
Maybe you are trying to apply to gRPC the standard approach used for Web APIs, right? If so, it doesn’t work.
I intend to write a blog post about authentication and authorization with gRPC, but currently I don’t know when it will be possible.
Please, stay tuned. I will let you know here when that blog post will be published.
I tried with Visual Studio Code. While running the client, I received an error:
Unhandled exception. Grpc.Core.RpcException: Status(StatusCode=Internal, Detail=
Error starting gRPC call: The SSL connection could not be established, see inner exception.
To solve the Visual Studio Code-related issue or because the dotnet development certificates are not set to be trusted, I ran command
dotnet dev-certs https --trust
in the terminal before running
Hope this hint help others tumbling with the same same issue.
BTW, thank you for sharing this well-written article!
Hey there @khoas!
I’m sure Andrea will address that once he’s online!
Thank you for sharing this valuable suggestion.
For completeness, the issue is not related to Visual Studio Code. It is a by-design behavior of the .NET Core SDK. As you pointed out, the HTTPS development certificate needs to be trusted before running any HTTPS-based application (not just gRPC).
This is a one-time operation. More info here.
I am getting below exception - have followed the the code correctly - have also tried amendinh Https to Http but to no avail…
Any suggestions appreciated…
Welcome to the Auth0 Community.
Assuming that the server is running, the exception you get usually happens for a couple of reasons:
- a firewall is blocking the connection
- the server is listening to a different port
Can you ensure that the server is listening to the same port used by the client?
Also, you didn’t specify your operating system. Please, take into account the limitations on macOS and older Windows versions explained in the article.
I am able to use that port in other applications successfully - doubt it’s a firewall issue.
As required I start the Service first and error occurs straight away…I don’t get to starting the Client.
Windows 10 OS
If you guys have any questions regarding that please add them in there!
When trying to run the client example, I get the following error:
Unhandled exception. Grpc.Core.RpcException: Status(StatusCode=Internal, Detail=“Bad gRPC response. Response protocol downgraded to HTTP/1.1.”)
at GrpcGreeterClient.Program.Main(String args) in C:\Source\Core\grpc-dotnet\CreditRatingClient\Program.cs:line 18
at GrpcGreeterClient.Program.(String args)
Any idea how to fix?
Thank you for reading this article.
Regarding your error, are you running TLS both on the client and the server? Or, if you are using a Mac, have you disabled TLS both on the client and the server?
Do you get the same error with the projects downloaded from the GitHub repository?
Please, let me know if the checks above help you to fix the issue.