microsoft / dev-proxy

Dev Proxy is an API simulator that helps you effortlessly test your app beyond the happy path.
https://aka.ms/devproxy
MIT License
475 stars 56 forks source link

Create JWT token command #882

Open garrytrinder opened 1 week ago

garrytrinder commented 1 week ago

When simulating auth developers need to generate a fake auth token to use in their code. This is not a trivial task.

We should help developers by creating a command that can generate tokens to be used for testing purposes.

dotnet user-jwts is a command line tool that can generate tokens for testing.

Example:

dotnet user-jwts create --audience 5fd6c579-77d2-4ad4-9064-b8b2297a6fb5 --scope "Posts.Read" --issuer "https://login.microsoftonline.com/bf805346-44e7-43f7-8e60-c5e24aefe49c/v2.0"

We should think about integrating this tool in Dev Proxy for convenience.

garrytrinder commented 1 week ago

The dotnet user-jwts tool is dependent on being executed within the context of a web project which limits it's usage.

waldekmastykarz commented 1 week ago

We should also consider issuing token signed with Dev Proxy's certificate so that they can be validated.