Auth0 Home Blog Docs

Swagger, Nswag and C# Client Generation

Hi!

I would like to create C# clients with which I can call the Management API and Authentication API. I am in the process of writing these clients.

I then found Nswag that allows one to generate C# client libraries with which to call a Web API.

Using Nswag requires providing the software a Swagger Specification Json file. Is it possible to obtain such a file for the Authentication and Management APIs?

If not, is there another way to auto create a C# client library for these two APIs?

Hi,

I think the official Auth0 .NET SDK includes clients for both the Authentication API and the Management API.

FWIW, there is a Swagger definition for the various management APIs which you can access at:

https://{tenantUrl}/api/v2/api-docs/{apiName}

For example:

https://mytenant.eu.auth0.com/api/v2/api-docs/Clients

Watch the capitalization on the API Name. No Swagger is returned if you get it wrong! You can get the list of APIs using:

https://{tenantUrl}/api/v2/api-docs

The Swagger which is returned is version 1.2 however we found that it’s not entirely compliant with the spec and needed to clean it up a bit first prior to conversion to Swagger 2 & OpenApi 3 with LucyBot.

This is perfect. I’ll look into it. Thank you!