Upgrade to Pro — share decks privately, control downloads, hide ads and more …

OAuth2.0 Easy Talk@HackerSir StudyGroup

Avatar for YUKAI YUKAI
May 30, 2025
7

OAuth2.0 Easy Talk@HackerSir StudyGroup

Avatar for YUKAI

YUKAI

May 30, 2025
Tweet

Transcript

  1. • Resource Owner:能夠授權存取權限的角色,也就是使用者 • Resource Server:存放資源的 Server • Authorization Server:負責驗證身分的

    Server • Client:發出 OAuth 授權請求的應用程式 Roles Resource Owner Client Resource Server Authorization Server
  2. • Client ID:第三方應用的 ID • Client Secert:第三方應用的密鑰 • Redirect URL:

    Authorization Server 成功驗證後要把資料打回去的 API, 通常是第三方應用的 Server API • Grant Type:授權方式 • Access Token:流程跑完最後用來取得 Resource 的 Token KeyWords
  3. • Case1:Next.js + NextAuth • Google OAuth • Github OAuth

    • Case2:Node.js + googleapis • Google OAuth • Resource:google developer doc OAuth2.0 Flow 實際情況
  4. • Authorization Server 會把 Code 以 Query String 打回 App

    Server 的 redirect URL • 接下來會在 Server 做 code 和 token 的交換 Case1: Authorization Grant
  5. Case1: Access Token • 在 Server 的 redirect URL 完成了

    Code 和 Access Token,可以發現 response cookies 多了個 session-token
  6. • Authorization Code Flow(Code -> Access Token) • Implicit Flow

    with Form Post(直接拿到 Access Token) • Resource Owner Password Flow(驗證過程變成在 Client 上) • Client Credentials Flow Grant Type
  7. • Resource Owner 與 Client 的角色重疊 • 拿取 Client 相關的資源

    • 應用:M2M Applications Client Credentials Flow