Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Authorize attribute on basic (non-Auth) TraderSys sample causes error. #1

Closed
zackJKnight opened this issue Feb 23, 2020 · 2 comments
Closed

Comments

@zackJKnight
Copy link

The sample could be more approachable if you remove the Authorize attribute from PortfolioService.cs

I get this exception when I run the sample:

   at Grpc.Net.Client.Internal.GrpcCall`2.ValidateHeaders()
   at Grpc.Net.Client.Internal.GrpcCall`2.<SendAsync>d__76.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   at Grpc.Net.Client.Internal.GrpcCall`2.<GetResponseHeadersAsync>d__67.MoveNext()

And the output clued me in that authorization is expected:

System.InvalidOperationException: Endpoint gRPC - /PortfolioService.Portfolios/Get contains authorization metadata, but a middleware was not found that supports authorization.
Configure your application startup by adding app.UseAuthorization() inside the call to Configure(..) in the application startup code. The call to app.UseAuthorization() must appear between app.UseRouting() and app.UseEndpoints(...).
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.ThrowMissingAuthMiddlewareException(Endpoint endpoint)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
@umitkavala
Copy link

umitkavala commented Mar 8, 2020

Same here. I've removed Authorize attribute to run example.

@VaishaliRaval
Copy link
Contributor

Hey @zackJKnight and @umitkavala Thanks for pointing it out. We have removed the Authorize attribute from the non-Auth TraderSys sample. Closing this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants