# VueJS + Api Core .net - Signature validation failed. Unable to match ‘kid'

**URL:** <https://devforum.okta.com/t/vuejs-api-core-net-signature-validation-failed-unable-to-match-kid/814>\
**Category:** OAuth/OIDC\
**Tags:** dotnet\
**Created:** [November 29, 2017, 4:08pm UTC](https://devforum.okta.com/t/vuejs-api-core-net-signature-validation-failed-unable-to-match-kid/814 "2017-11-29T16:08:34Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Loic](https://avatars.discourse-cdn.com/v4/letter/l/e9c0ed/32.png) [@Loic](https://devforum.okta.com/u/Loic)\
**Post date:** [November 29, 2017, 4:08pm UTC](https://devforum.okta.com/t/vuejs-api-core-net-signature-validation-failed-unable-to-match-kid/814/1 "2017-11-29T16:08:34Z")

</div>

Hi,

I am tring to set up openid authentification with jwt Token between a VueJs Front and API in .net core.  
But i’m having a error in the .net core api “signature validation failed. Unable to match ‘kid’”.

Which token do i send to .net core ? id\_token or access\_token ?  
What am i doing wrong ?

Sample code

//Url in vueJs  
const authUrl = `https://${okta.urlOrga}/oauth2/v1/authorize?client_id=${okta.clientId} &response_type=id_token &nonce=1234567 &scope=openid email groups &state=test &redirect_uri=${window.location.href}`

//Code in .net Core

services.AddAuthentication(sharedOptions =\>  
{  
sharedOptions.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;  
sharedOptions.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;  
})  
.AddJwtBearer(options =\>  
{  
options.Authority = “https://{okta.urlOrga}/oauth2/default”;  
options.Audience = “api://default”;  
});

//ERROR  
IDX10501: Signature validation failed. Unable to match ‘kid’: …

---

<div class="post-metadata">

**Author:** ![mraible](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/mraible/32/37_2.png) [@mraible](https://devforum.okta.com/u/mraible)\
**Post date:** [November 29, 2017, 4:14pm UTC](https://devforum.okta.com/t/vuejs-api-core-net-signature-validation-failed-unable-to-match-kid/814/2 "2017-11-29T16:14:08Z")

</div>

Try using `https://${okta.urlOrga}/oauth2/default/v1/authorize` instead of the value you’re currently using.

> [@Loic](#):
>
> https://${okta.urlOrga}/oauth2/v1/authorize

---

<div class="post-metadata">

**Author:** ![Loic](https://avatars.discourse-cdn.com/v4/letter/l/e9c0ed/32.png) [@Loic](https://devforum.okta.com/u/Loic)\
**Post date:** [November 29, 2017, 4:30pm UTC](https://devforum.okta.com/t/vuejs-api-core-net-signature-validation-failed-unable-to-match-kid/814/3 "2017-11-29T16:30:51Z")

</div>

I have a 404 from okta because it trying to go to  
[https://XXXX.oktapreview.com/default/oauth2/v1/authorize?client\_id=XXXXXXX&response\_type=id\_token&nonce=1234567&scope=openid%20email%20groups&state=test&redirect\_uri=XXXXXXX](https://XXXX.oktapreview.com/default/oauth2/v1/authorize?client_id=XXXXXXX&response_type=id_token&nonce=1234567&scope=openid%20email%20groups&state=test&redirect_uri=XXXXXXX)

---

<div class="post-metadata">

**Author:** ![mraible](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/mraible/32/37_2.png) [@mraible](https://devforum.okta.com/u/mraible)\
**Post date:** [November 29, 2017, 4:33pm UTC](https://devforum.okta.com/t/vuejs-api-core-net-signature-validation-failed-unable-to-match-kid/814/4 "2017-11-29T16:33:15Z")

</div>

Hmmm, it sounds like you don’t have a default Authorization server setup. Can you please email [developers@okta.com](mailto:developers@okta.com) and ask them to configure this for your organization?

---

<div class="post-metadata">

**Author:** ![Loic](https://avatars.discourse-cdn.com/v4/letter/l/e9c0ed/32.png) [@Loic](https://devforum.okta.com/u/Loic)\
**Post date:** [November 29, 2017, 4:58pm UTC](https://devforum.okta.com/t/vuejs-api-core-net-signature-validation-failed-unable-to-match-kid/814/5 "2017-11-29T16:58:29Z")

</div>

I have a default authorization server and a custom

 ![image](https://global.discourse-cdn.com/oktadev/original/1X/a8886022f5fbd994914315968e334b4051c3e25d.png)

---

<div class="post-metadata">

**Author:** ![Loic](https://avatars.discourse-cdn.com/v4/letter/l/e9c0ed/32.png) [@Loic](https://devforum.okta.com/u/Loic)\
**Post date:** [November 29, 2017, 4:59pm UTC](https://devforum.okta.com/t/vuejs-api-core-net-signature-validation-failed-unable-to-match-kid/814/6 "2017-11-29T16:59:01Z")

</div>

![image](https://global.discourse-cdn.com/oktadev/original/1X/0c6f98ff8d90d25219255d38fdba82a01b3fdbae.png)

---

<div class="post-metadata">

**Author:** ![mraible](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/mraible/32/37_2.png) [@mraible](https://devforum.okta.com/u/mraible)\
**Post date:** [November 29, 2017, 5:03pm UTC](https://devforum.okta.com/t/vuejs-api-core-net-signature-validation-failed-unable-to-match-kid/814/7 "2017-11-29T17:03:35Z")

</div>

If you have a default authorization server, it’s strange that you’re getting a 404. I’m not sure what could be causing this issue, unless you’re somehow getting the authorization endpoint wrong. You should be able to get the endpoint URLs from your org’s `.well-known/oauth-authorization-server`. For example: [https://dev-158606.oktapreview.com/oauth2/default/.well-known/oauth-authorization-server](https://dev-158606.oktapreview.com/oauth2/default/.well-known/oauth-authorization-server)

---

<div class="post-metadata">

**Author:** ![Loic](https://avatars.discourse-cdn.com/v4/letter/l/e9c0ed/32.png) [@Loic](https://devforum.okta.com/u/Loic)\
**Post date:** [November 29, 2017, 5:33pm UTC](https://devforum.okta.com/t/vuejs-api-core-net-signature-validation-failed-unable-to-match-kid/814/8 "2017-11-29T17:33:31Z")

</div>

No more 404, clear cookie & co , but i still have a invalid token.

Microsoft.IdentityModel.Tokens.SecurityTokenSignatureKeyNotFoundException: 'IDX10501: Signature validation failed. Unable to match ‘kid’:

I test with id\_token or access token…

If I use a custom authorization server in front, should i change the authority and audience in the back ?

.AddJwtBearer(options =\>  
{  
options.Authority = “[https://XXXX.oktapreview.com/oauth2/default](https://XXXX.oktapreview.com/oauth2/default)”;  
options.Audience = “api://default”;  
});

---

<div class="post-metadata">

**Author:** ![tom](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/tom/32/24_2.png) [@tom](https://devforum.okta.com/u/tom)\
**Post date:** [November 29, 2017, 11:09pm UTC](https://devforum.okta.com/t/vuejs-api-core-net-signature-validation-failed-unable-to-match-kid/814/9 "2017-11-29T23:09:44Z")

</div>

Hi @Loic, they need to match.

You are running into a similar problem as: [Error: The signature key was not found](https://devforum.okta.com/t/error-the-signature-key-was-not-found/696/2)

This is usually because the backend integration is checking an authorization server that doesn’t have the public key (identified by a kid) that the access token is reporting in the header of the JWT. I have some additional troubleshooting steps in the other post.

Let me know if that get’s this resolved for you, thanks!  
Tom

---

<div class="post-metadata">

**Author:** ![Loic](https://avatars.discourse-cdn.com/v4/letter/l/e9c0ed/32.png) [@Loic](https://devforum.okta.com/u/Loic)\
**Post date:** [November 30, 2017, 8:34am UTC](https://devforum.okta.com/t/vuejs-api-core-net-signature-validation-failed-unable-to-match-kid/814/10 "2017-11-30T08:34:28Z")

</div>

Thx Tom, it’s working !

I did not understand that the audience in .net core need to be the client ID of the application use in url in auth.js

I need to add groups in the token, so i add a custom claims in the aurtorisation server, good choice ?

Can i use a custom authorisation server for a application ? how to change the issuer ?

 ![image](https://global.discourse-cdn.com/oktadev/original/1X/c4eaa665a24cd52d513c00eb04d25b4652eb0d27.png)

---

<div class="post-metadata">

**Author:** ![Loic](https://avatars.discourse-cdn.com/v4/letter/l/e9c0ed/32.png) [@Loic](https://devforum.okta.com/u/Loic)\
**Post date:** [November 30, 2017, 8:51am UTC](https://devforum.okta.com/t/vuejs-api-core-net-signature-validation-failed-unable-to-match-kid/814/11 "2017-11-30T08:51:26Z")

</div>

I solved my probem.

I’m using the default authorisation server with a custom claims only show in the custom scopes to not disturb other applications for my specific need.

 ![image](https://global.discourse-cdn.com/oktadev/original/1X/1b0cf053240606cdb6fb5d070b79f87bb71fc137.png)

---

<div class="post-metadata">

**Author:** ![tom](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/tom/32/24_2.png) [@tom](https://devforum.okta.com/u/tom)\
**Post date:** [November 30, 2017, 5:03pm UTC](https://devforum.okta.com/t/vuejs-api-core-net-signature-validation-failed-unable-to-match-kid/814/12 "2017-11-30T17:03:39Z")

</div>

Glad you got it fixed! Definitely use the default authorization server (`/oauth/default`) as this is the authorization server for custom applications.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [January 12, 2024, 9:23pm UTC](https://devforum.okta.com/t/vuejs-api-core-net-signature-validation-failed-unable-to-match-kid/814/13 "2024-01-12T21:23:37Z")

</div>

Closed on January 12, 2024, 9:23pm UTC

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
