Attempting to retrieve refresh token with OpenIddict gives Internal Server Error -


i'm trying obtain access , refresh tokens using openiddict library.

everything seems fine when requesting access token. when adding scope = offline_access, 500 internal server error returned.

using postman grant_type = password, , username , password set, valid access_token returned.

but after appending scope = offline_access, status 500 internal server error.

i register openiddict services

services.addopeniddict(options => {     options.addentityframeworkcorestores<dbcontext>();     options.addmvcbinders();     options.enabletokenendpoint("/connect/token");     options.allowpasswordflow();     options.allowrefreshtokenflow();     options.addephemeralsigningkey();     options.disablehttpsrequirement(); }); 

i register openiddict , validation middleware

public void configure(iapplicationbuilder app, ihostingenvironment env, iloggerfactory loggerfactory) {     app.useoauthvalidation(options => {         options.automaticauthenticate = true;         options.automaticchallenge = true;     });      app.useopeniddict();      app.usemvcwithdefaultroute(); } 

and create token authentication controller

[httppost("~/connect/token"), produces("application/json")] public async task<iactionresult> exchange(openidconnectrequest request) {     if (request.ispasswordgranttype())     {         var identity = new claimsidentity(openidconnectserverdefaults.authenticationscheme);          identity.addclaim(openidconnectconstants.claims.subject,             user.id.tostring,             openidconnectconstants.destinations.accesstoken);              var ticket = new authenticationticket(                 new claimsprincipal(identity),                 new authenticationproperties(),                 openidconnectserverdefaults.authenticationscheme);              ticket.setresources(request.getresources());             ticket.setscopes(request.getscopes());              return signin(ticket.principal, ticket.properties, ticket.authenticationscheme);         } } 

the error goes away if setscopes call removed, no refresh token returned.

going round in circles now. appreciated.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -