Skip to content

Latest commit

 

History

History
64 lines (56 loc) · 3.54 KB

131_authorization-code-flow.md

File metadata and controls

64 lines (56 loc) · 3.54 KB

Authorization Code Flow (With PKCE)

RFC reference

flow

  1. User initializes authentication and authorization flow.
  2. Client sends auth request, response_type=code. PKCE1
    GET /authorize
  3. Request is verified by IAM-service.
  4. IAM-service responds, providing login context.
  5. User enters login credentials.
  6. Client sends login user's login credentials to IAM-service.
    POST /authorize
  7. IAM-service verifies login credentials and responds with scope data for user.
  8. Client received available scopes / permissions and presents consent screen to user.
  9. Selects scope for this auth action and confirm.
  10. Client sends back list of approved scopes.
    POST /consent
  11. Approved scopes are evaluated and authorization code is issued.
  12. Client is redirected to Callback URL handing over code.
  13. Resource server sends code to IAM-service. PKCE2
    POST /token
  14. IAM-service issues tokens and sends back access_token and refresh_token.
  15. access_token and refresh_token are forwarded to client.
  16. Login flow is finished.
  17. Token Verification process, back channel.
  18. Access resources using issued access_token.
  19. Refresh Tokens flow.

PKCE fow extension

  • PKCE1 - Client sends Authorization Request with code_challenge and code_challenge_method as specified in RFC7636.
  • PKCE2 - Authorization Code is send together with original code_verifier RFC7636.

Test in Browser

  • Init login flow using web browser.
    curl --location --request GET 'http://localhost:8080/services/oauth2/{organization-id}/{project-id}/authorize?response_type=code&state={state}&client_id={client-id}&client_secret={client-secret}&scope=&redirect_uri={redirect-uri}'
    

Test in Postman

Name Value
Grant Type Authorization Code (With PKCE**)
Callback URL http://localhost:8080/services/oauth2/iam-admins/iam-admins/redirect
Auth URL http://localhost:8080/services/oauth2/iam-admins/iam-admins/authorize
Access Token URL http://localhost:8080/services/oauth2/iam-admins/iam-admins/token
Client ID admin-client
Client Secret top-secret
Code Challenge Method ** SHA-256 or Plain
Code Verifier **
Scope ""
State

** Only for flow with PKCE

postman postman postman

Test in Insomnia

insomnia insomnia insomnia