angularjs - OWIN OpenId "insufficient_scope" when using OpenIDConnect token for CORS request -
angularjs - OWIN OpenId "insufficient_scope" when using OpenIDConnect token for CORS request -
what need enable cors owin openid connect tokens in asp.net mvc webapi?
i'm using thinktecture identity server v3 , implicit flow.
i've gpt angularjs application hosted on https://b3ncr.comms/, identityserver v3 on https://b3ncr.auth/ , api on https://b3ncr.comms.api/
my api configured follows.
app.useidentityserverjwt(new jwttokenvalidationoptions { authorization = "https://b3ncr.auth:44340/identity" }); app.requirescopes("sampleapi");
i login , token next parameters.
https://b3ncr.auth:44340/identity/connect/authorize?response_type=id_token token &client_id=implicit &scope=openid profile sampleapi &redirect_uri=https://b3ncr.comms:44341/logon &nonce=blah
that returns token expected , extract , seek phone call api. when seek phone call api token angularjs makes next http request:
request url:https://b3ncr.comms.api:44342/api/identity request method:options accept:*/* accept-encoding:gzip,deflate accept-language:en-gb,en-us;q=0.8,en;q=0.6 access-control-request-headers:accept, authorization access-control-request-method:post cache-control:no-cache connection:keep-alive host:b3ncr.comms.api:44342 origin:https://b3ncr.comms:44341 pragma:no-cache referer:https://b3ncr.comms:44341/
and api returns next headers:
access-control-allow-headers:content-type, authorization access-control-allow-methods:get,put,post,delete,options access-control-allow-origin:* content-length:0 date:mon, 27 oct 2014 22:48:24 gmt server:microsoft-iis/8.5 www-authenticate:bearer error="insufficient_scope" x-powered-by:asp.net
to me looks owin middleware rejecting request because token doesn't contain scope api requiring , requested authorize parameters. if utilize token directly, in fiddler illustration works perfectly.
edit: didn't include { withcredentials: true }
config alternative on request. i've added still getting same issue.
edit again: turns out i'm not supposed utilize withcredentials authorization header, that's using cookies.
angularjs asp.net-web-api cors owin thinktecture-ident-server
Comments
Post a Comment