Skip to content

Add authentication header after login #197

Answered by canton7
mhmmdsmdi asked this question in Q&A
Discussion options

You must be logged in to vote

You've basically got two options:

  1. Add the Authentication header as a property on IUserApi. In this case, you'll need to assign that property for every instance of IUserApi which is created. There's nothing built-in to let you do this, so you'll have to register IUserApi with the IoC container yourself (without using UseWithRestEaseClient), and add the necessary code to assign to that Authentication header.
  2. Add the Authentication header using a custom HttpMessageHandler. You can then register that, using e.g. .AddHttpClient("...").ConfigurePrimaryHttpMessageHandler(...).UseWithRestEaseClient<IUserApi>().

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mhmmdsmdi
Comment options

Answer selected by mhmmdsmdi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants