Comments (3)
Hey @nicosabena,
Let's go with the static method idea, taking both clientId
and domain
parameters. It would nice to use a static Dictionary<string, RestClient>
as a cache to avoid creating a new rest client every time it it called.
I think that is the best way to do it with the current code without breaking the API. Eventually if we see that more of these methods (that don't require clientSecret
) are to be added to the API then we can introduce a better design with an Auth0Credentials
object that takes care of GetToken()
only if a clientSecret
was provided when it was created (and otherwise throws).
Thanks,
from auth0.net.
The RestClient constructor is extremely lightweight, so I wouldn't worry about caching it.
Another option could be to have two "levels" of the Client instance:
- The current one, when you provide both ClientId and ClientSecret in the constructor, that lets you access any method.
var client = new Auth0.Client(clientId, clientSecret, domain);
// I can do whatever I want, yeah!
client.CreateConnection(...);
- Another one, when you provide only the ClientId (and the domain, of course), that would only let you execute methods that do not require a token/clientSecret.
var client = new Auth0.Client(clientId, domain);
// restricted Access
var token = client.LoginUser(...);
// throws
client.CreateConnection(); // SecurityException or something
I'm just thinking out loud here, but sound better tan the static method. Opinions?
from auth0.net.
@nicosabena I like the two constructors alternative. We need to update GetAccesToken
to throw if no secret is provided.
Nice!
from auth0.net.
Related Issues (20)
- Please add Grants to Management Client HOT 1
- Client Deserialization Issue HOT 1
- Organization Update: Add Name HOT 1
- Management client missing cross-origin settings for client creation HOT 1
- disable_signup not set when using SDK HOT 7
- Retrieve User.AppMetadata as specific type instead of dynamic HOT 3
- expose external_id on Auth0.ManagementApi.Models.Job HOT 7
- Expose is_domain_connection on Connection HOT 1
- Better support IHttpClientFactory in AuthenticationApiClient HOT 7
- Support `fields` property on Get Members in Organization endpoint HOT 1
- PasswordChangeRequestTicket is missing Connection parameter HOT 1
- AuthenticationApiClient caches JsonWebKeySet only for the first 10 minutes for GetTokenAsync(RefreshTokenRequest request) HOT 2
- Implement mfa/associate endpoint
- Implement delete mfa/authenticators endpoint
- Implement get mfa/authenticators endpoint
- Move from `System.IdentityModel.Tokens.Jwt` to `Microsoft.IdentityModel.JsonWebTokens`
- Please add methods PutAppMetadata<T> and PutUserMetadata<T> for User to function as a merge HOT 3
- Actions object missing installed integration data
- Add ability to install Marketplace integrations from the API
- Native AOT Support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from auth0.net.