feat: add authkit action helper#46
Draft
DennisKraaijeveld wants to merge 1 commit intoworkos:mainfrom
Draft
Conversation
Contributor
Greptile Summary
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant "React Router" as RR
participant "authkitAction" as AKA
participant "updateSession" as US
participant "handleAuthAction" as HAA
participant "Custom Action" as CA
User->>RR: "Submit form (POST)"
RR->>AKA: "Call authkitAction(args, customAction, options)"
AKA->>US: "Get/refresh session from cookie"
alt Session valid
US-->>AKA: "Return session with access token"
AKA->>HAA: "Pass auth data and session"
HAA->>CA: "Call customAction({ auth, getAccessToken })"
CA-->>HAA: "Return action result"
HAA-->>AKA: "Merge result with auth data"
AKA-->>RR: "Return data with Set-Cookie header"
else Session expired but refresh succeeds
US->>US: "Refresh tokens via WorkOS"
US-->>AKA: "Return new session with fresh tokens"
AKA->>HAA: "Pass auth data and new session"
HAA->>CA: "Call customAction({ auth, getAccessToken })"
CA-->>HAA: "Return action result"
HAA-->>AKA: "Merge result with auth data"
AKA-->>RR: "Return data with updated Set-Cookie"
else No session or refresh fails
US-->>AKA: "Throw SessionRefreshError"
AKA->>AKA: "Destroy session cookie"
AKA-->>RR: "Redirect to authorization URL"
end
RR-->>User: "Return response"
|
Contributor
There was a problem hiding this comment.
5 files reviewed, no comments
Edit Code Review Agent Settings | Greptile
React with 👍 or 👎 to share your feedback on this new summary format
Contributor
Author
|
Putting this back in draft. Depends on #44 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduces authkitAction, the action-side equivalent to authkitLoader, so React Router actions get the same session refresh, cookie management, and auth / getAccessToken ergonomics as loaders.