Access Token Validation in Web API 2 Framework 4.x with Identity Server 4
up vote
0
down vote
favorite
Hopefully someone can point me in the right direction, I need to validate the access token issued by identity server 4 in my api.
Authorized attribute is already set in the API.
Access token is retrieved correctly from server, but when passsing the access token to the request, i got an 401 Unauthorized error, and nothing is processed the request is rejected. I am using IdentityServer3.AccessTokenValidation nuget package.
I noticed for v4 of the AccessTokenValidation you can set RequireHttpsMetadata = false but i dont see how in v3.
Is this the best way to do this or should i be looking into another direction ?
public void ConfigureAuth(IAppBuilder app)
{
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "Cookies",
});
JwtSecurityTokenHandler.InboundClaimTypeMap = new Dictionary<string,
string>
();
app.UseIdentityServerBearerTokenAuthentication
(new IdentityServerBearerTokenAuthenticationOptions
{
Authority = "http://localhost:5000",
RequiredScopes = new { "api2" },
});
}
Thanks
oauth-2.0 asp.net-web-api2 identityserver4 identityserver3
add a comment |
up vote
0
down vote
favorite
Hopefully someone can point me in the right direction, I need to validate the access token issued by identity server 4 in my api.
Authorized attribute is already set in the API.
Access token is retrieved correctly from server, but when passsing the access token to the request, i got an 401 Unauthorized error, and nothing is processed the request is rejected. I am using IdentityServer3.AccessTokenValidation nuget package.
I noticed for v4 of the AccessTokenValidation you can set RequireHttpsMetadata = false but i dont see how in v3.
Is this the best way to do this or should i be looking into another direction ?
public void ConfigureAuth(IAppBuilder app)
{
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "Cookies",
});
JwtSecurityTokenHandler.InboundClaimTypeMap = new Dictionary<string,
string>
();
app.UseIdentityServerBearerTokenAuthentication
(new IdentityServerBearerTokenAuthenticationOptions
{
Authority = "http://localhost:5000",
RequiredScopes = new { "api2" },
});
}
Thanks
oauth-2.0 asp.net-web-api2 identityserver4 identityserver3
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Hopefully someone can point me in the right direction, I need to validate the access token issued by identity server 4 in my api.
Authorized attribute is already set in the API.
Access token is retrieved correctly from server, but when passsing the access token to the request, i got an 401 Unauthorized error, and nothing is processed the request is rejected. I am using IdentityServer3.AccessTokenValidation nuget package.
I noticed for v4 of the AccessTokenValidation you can set RequireHttpsMetadata = false but i dont see how in v3.
Is this the best way to do this or should i be looking into another direction ?
public void ConfigureAuth(IAppBuilder app)
{
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "Cookies",
});
JwtSecurityTokenHandler.InboundClaimTypeMap = new Dictionary<string,
string>
();
app.UseIdentityServerBearerTokenAuthentication
(new IdentityServerBearerTokenAuthenticationOptions
{
Authority = "http://localhost:5000",
RequiredScopes = new { "api2" },
});
}
Thanks
oauth-2.0 asp.net-web-api2 identityserver4 identityserver3
Hopefully someone can point me in the right direction, I need to validate the access token issued by identity server 4 in my api.
Authorized attribute is already set in the API.
Access token is retrieved correctly from server, but when passsing the access token to the request, i got an 401 Unauthorized error, and nothing is processed the request is rejected. I am using IdentityServer3.AccessTokenValidation nuget package.
I noticed for v4 of the AccessTokenValidation you can set RequireHttpsMetadata = false but i dont see how in v3.
Is this the best way to do this or should i be looking into another direction ?
public void ConfigureAuth(IAppBuilder app)
{
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "Cookies",
});
JwtSecurityTokenHandler.InboundClaimTypeMap = new Dictionary<string,
string>
();
app.UseIdentityServerBearerTokenAuthentication
(new IdentityServerBearerTokenAuthenticationOptions
{
Authority = "http://localhost:5000",
RequiredScopes = new { "api2" },
});
}
Thanks
oauth-2.0 asp.net-web-api2 identityserver4 identityserver3
oauth-2.0 asp.net-web-api2 identityserver4 identityserver3
edited Nov 17 at 16:28
asked Nov 17 at 15:18
Jonnathan Molina Prada
23115
23115
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53352564%2faccess-token-validation-in-web-api-2-framework-4-x-with-identity-server-4%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown