# How does Resource server verifies token for HS256 or HS512

**URL:** <https://community.auth0.com/t/how-does-resource-server-verifies-token-for-hs256-or-hs512/37527>\
**Category:** JWT.io\
**Created:** [February 6, 2020, 10:41am UTC](https://community.auth0.com/t/how-does-resource-server-verifies-token-for-hs256-or-hs512/37527 "2020-02-06T10:41:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ethenhunt321](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ethenhunt321/32/18987_2.png) [@ethenhunt321](https://community.auth0.com/u/ethenhunt321)\
**Post date:** [February 6, 2020, 10:41am UTC](https://community.auth0.com/t/how-does-resource-server-verifies-token-for-hs256-or-hs512/37527/1 "2020-02-06T10:41:35Z")

</div>

I have created a token using any of the algorithm say HS256, when this is passed to resource server, I can see the implementation like below

TokenValidationParameters validationParameters = new TokenValidationParameters()  
{  
ValidAudience = ActiveDirectory.audience,  
ValidIssuer = ActiveDirectory.issuer,  
ValidateLifetime = true,  
ValidateIssuerSigningKey = true,  
LifetimeValidator = this.LifetimeValidator,  
IssuerSigningKey = new SymmetricSecurityKey(System.Text.Encoding.Default.GetBytes(ActiveDirectory.clientSecret))  
};

Notice here that while validating token, No algorithm is passed (it must be HS256 to compare hashing).

Now lets say, I have changed algorithm while creating token from HS256 to HS512, Here my resource server still validates the token successfully ?

Could anyone help me specifying algorithm on resource server to validate against token.

---

<div class="post-metadata">

**Author:** ![markd](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/markd/32/38919_2.png) [@markd](https://community.auth0.com/u/markd)\
**Post date:** [February 6, 2020, 5:02pm UTC](https://community.auth0.com/t/how-does-resource-server-verifies-token-for-hs256-or-hs512/37527/2 "2020-02-06T17:02:51Z")

</div>

Hello @ethenhunt321,

Welcome to the Community! I believe the only options for signing tokens in Auth0, both ID tokens and access tokens, are RS256 (the default and preferred option) and HS256. The algorithm will be embedded in the header portion of the JWT. Have a look at [https://jwt.io/](https://jwt.io/).

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [February 7, 2020, 7:38am UTC](https://community.auth0.com/t/how-does-resource-server-verifies-token-for-hs256-or-hs512/37527/3 "2020-02-07T07:38:48Z")

</div>

Yep, that is correct

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [February 22, 2020, 7:38am UTC](https://community.auth0.com/t/how-does-resource-server-verifies-token-for-hs256-or-hs512/37527/4 "2020-02-22T07:38:50Z")

</div>

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