When to use RS256 for JWT?

时光总嘲笑我的痴心妄想 提交于 2019-12-01 06:15:22

Use RS256 when:

  • tokens are signed by a third party, usually an Identity Provider(e.g. oauth2/oidc), and you need to verify that the token has been issued by a trusted entity

  • tokens are signed by clients, usually to get access to an API, where clients have previously registered the public key

  • tokens are signed by a centralized authentication server in a SingleSignOn system and they are used to get access to several federated servers

  • tokens are used to transfer data between two parties, not neccesarily for authentication purposes, and the signature is used to ensure the identity of the signatory

Use HS256 when:

  • tokens are signed and validated by the same server
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!