# Id\_token retrieved in RS256 instead of HS256 (Auth0, Swift)

**URL:** <https://community.auth0.com/t/id-token-retrieved-in-rs256-instead-of-hs256-auth0-swift/8652>\
**Category:** Get Help\
**Tags:** authorization, rs256, hs256, swift, auth0\
**Created:** [November 2, 2017, 1:36am UTC](https://community.auth0.com/t/id-token-retrieved-in-rs256-instead-of-hs256-auth0-swift/8652 "2017-11-02T01:36:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fivebyfiveyeah](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@fivebyfiveyeah](https://community.auth0.com/u/fivebyfiveyeah)\
**Post date:** [November 2, 2017, 1:36am UTC](https://community.auth0.com/t/id-token-retrieved-in-rs256-instead-of-hs256-auth0-swift/8652/1 "2017-11-02T01:36:04Z")

</div>

The main native client I’m using is set to receive HS256 tokens. However, when I log in, these get sent out as RS256 and I’m getting an unauthorised error whenever I call the API I want to get access to.

I’ve tried accessing oauth/token endpoint with my credentials as listed on here ([text][Resource Owner Password Flow - Auth0 Docs](https://auth0.com/docs/api-auth/tutorials/adoption/password#authentication-request) “authentication-request”) - that hasn’t worked either. The audience is set and the scope has all options selected (openid profile offline\_access), so that’s not the issue.

Not sure how to solve this as only a jwt token in HS256 format will be accepted by the server.

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [November 7, 2017, 9:18pm UTC](https://community.auth0.com/t/id-token-retrieved-in-rs256-instead-of-hs256-auth0-swift/8652/2 "2017-11-07T21:18:39Z")

</div>

There’s a few things worth mentioning here, in particular:

- for OIDC conformant client or requests (a request with `audience` is equivalent to OIDC conformance) **the ID tokens issued for public clients are forced to RS256** no matter the setting you selected. A native application is considered a public client hence the behavior.
- you should not be sending ID tokens to an API as a method of authoriation; see [Access Tokens](https://auth0.com/docs/api-auth/why-use-access-tokens-to-secure-apis)

With the above in mind you should be configuring the API in Auth0, selecting the signing algorithm at the API settings to be HS256 and then using an access token to call the API. At this time, an access token issued to your own API/audience will be a JWT token and it will honor the signing algorithm chosen at the API settings.

---

<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:** [March 2, 2018, 5:57am UTC](https://community.auth0.com/t/id-token-retrieved-in-rs256-instead-of-hs256-auth0-swift/8652/3 "2018-03-02T05:57:15Z")

</div>


