c# - "username/password couple is invalid" -


trying sign in user using postman. have implemented openiddict authentication solution using oauth2 token validation middelware. when im trying access, following error message:

username/password couple invalid

i have following test user.

using (var servicescope = app.applicationservices.getrequiredservice<iservicescopefactory>().createscope()) {     var db = servicescope.serviceprovider.getservice<applicationdbcontext>();      db.database.ensuredeleted();     db.database.ensurecreated();      var user = new user();     var hasher = new passwordhasher<user>();      db.addrange(         new applicationuser { firstname = "thomas", lastname = "smith", username = "user@test.com",              email = "user@test.com", passwordhash = hasher.hashpassword(user, "password1") },     );     db.savechanges(); } 

my setup in postman: my setup in postman

when debug in authorizationcontroller, user variable turns out null though input variable correct.

if (request.ispasswordgranttype()) {     var user = await _usermanager.findbynameasync(request.username);     if (user == null){         return badrequest(new openidconnectresponse {             error = openidconnectconstants.errors.invalidgrant,             errordescription = "the username/password couple invalid."         });     } 

do have code in async method? guess it's not blocking on await, , testing if user == null before user lookup returns. try adding delay in there , see if changes it.


Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

java - How to provide dependency injections in Eclipse RCP 3.x? -