asp.net - How to request a refresh token with identityserver4 -


i have identityserver , separate webapi project using resource owner flow.

when request token below token issued , can used access webapi. assume identityserver setup correctly, , webapi project setup correctly well.

username=user1 password=user1password grant_type=password client_id=myclientid client_secret=myclientsecret scope=api1 

now when change grant type refresh , scope offline_access refresh token. use refresh token access token, when use access token request webapi rejected.

with error

the audience invalid 

i suspect it's because asking offline_access scope instead of api1 scope webapi project expects. how refresh token can use used scope api1?

 var model =       {                     client_id: "myclientid",                     client_secret: "myclientsecret",                     scope: "api1 offline_access",                     token_type: "bearer", //optional                     grant_type: "refresh_token",                     refresh_token: "your refresh token"                 };   //this important step when use refresh token    var base64 = btoa(model.client_id + ":" + model.client_secret);   //and request here  this.$http({                 method: "post",                 url: "/connect/token",                 headers: {                     'content-type': "application/x-www-form-urlencoded",                     'authorization': "basic " + base64                 },                 data: jquery.param(model)             })                 .then(                 response => {                     //success                   },                 response => {                      //logout                 }); 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -