1、应用类型推荐授权流
Server-side (AKA Web) | Authorization Code flow |
Single-Page Application | Authorization Code flow with PKCE or Implicit flow |
Native | Authorization Code flow with PKCE |
Trusted | Resource Owner Password flow |
Service | Client Credentials |
1.1 Authorization Code flow
1.2 Authorization Code flow with PKCE
首先生成称为code verifier的随机键,然后计算得到code challenge,在请求获取code时发送code challenge
当在请求获取access token时,code和code verifier一起发送。授权服务器用协商的加密算法使用code verifier计算得到code challenge,作比较,如果两个code challenge匹配,就认证通过,返回access token
1.3 Implicit flow
1.4 Resource Owner Password flow
1.5 Client Credentials
参考资料: