re: Developing token authentication using ASP.NET Core VIEW POST

re: When i pass the Authorization Bearer in header, it gives me this error: The header name format is invalid. This is how i'm passing it: client.Def...

Another approach..
If you download the tool Postman you can easily check how this works.
After you revieced your token, you just have to put into Header:
Key: Authorization
Value: Bearer YOUR_TOKEN
including the whitespace between Baerer and your token!

I get nothing but 401s using this very approach in Postman.

Try This

client.DefaultRequestHeaders.Add("Authorization",string.Concat("Bearer ", json.accessToken));

code of conduct - report abuse