I tried using the auth0 postman template to make an authentication request using username and password and I'm getting an unsupported grant type: password error
. What am I doing wrong?
var client = new RestClient("https://test.auth0.com/oauth/token");
var request = new RestRequest(Method.POST);
request.AddHeader("postman-token", "abc");
request.AddHeader("cache-control", "no-cache");
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddParameter("application/x-www-form-urlencoded", "grant_type=password&client_id=foo&audience=&username=test&password=test&scope=openid%20email%20picture%20nickname", ParameterType.RequestBody);
The Password grant type is a way to exchange a user's credentials for an access token. Because the client application has to collect the user's password and send it to the authorization server, it is not recommended that this grant be used at all anymore.
Auth0 uses the OpenID Connect (OIDC) Protocol and OAuth 2.0 Authorization Framework to authenticate users and get their authorization to access protected resources.
Authentication is the act of identifying a user or a device. Authorization is the act of allowing or denying users and devices access rights.
API Authorization Settings
sectionDefault Audience
would be your API identifier (if you have an API)Default Directory
would be your connection such as database connection nameIn your POST to oauth/token do not include audience (if you specified the default above).
Gotta love how Auth0 makes authentication easy and painfully hard at the same time.
Refer below screenshot as a reference.
Go to Default App > Settings >
In the bottom of settings, Click {Show Advanced Settings}
Select Grant Types Tab
Check the password which is unchecked by default
Post request to *//oauth/token and it works
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With