Auth0 Home Blog Docs

How to get JWT for Integration Test?




I m currently using social authentication (which is working) for my website Asp.Net Core with Angular.
I would like to be able to test my webserver using xUnit Test. For this, I need a bearer.

So to get the JWT i need to call :
But to call it, first i Need to call:

but when I call:

I have a web page as result not a json.

What is your easiest solution to get a new JWT from a userId ?

Thank you


You can get an access_token using the Client Credentials Grant flow:

This will not present a user interface.

The issue however is that the sub claim of the token (and therefore the “user id” you will retrieve inside your ASP.NET application) will not be a user, but an application. This may be acceptable under certain circumstances - for example if you do not care that the sub of the token is an actual user.

So I guess my follow up question would be, do you use the user id inside your application?