Repository navigation
Auth auto refresh token - #195
Merged
Merged
Conversation
davixcky
requested review from
daniel-de-vera,
foxish and
scott-cotton
and removed request for
daniel-de-vera
July 3, 2025 19:36
| ) | ||
|
|
||
| var ( | ||
| AuthExpiredError = errors.New("Authentication expired. Please log in using 'signadot auth login'") |
Member
There was a problem hiding this comment.
According to Go standards and static check, error variables should start with Err, so these should be renamed ErrAuthExpired etc.
| if err != nil { | ||
| return err | ||
| } | ||
| authInfo = newAuthInfo |
Member
There was a problem hiding this comment.
This doesn't do anything, because Go is call by value (see https://go.dev/doc/faq#pass_by_value)
did you mean *authInfo = *newAuthInfo?
scott-cotton
approved these changes
Jul 25, 2025
scott-cotton
left a comment
Member
There was a problem hiding this comment.
LGTM
@davixcky can you test in a way that exercises the changes before merge?
Contributor
Author
|
Tested again, and seems to keep refreshing the token |
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.
Warning
This depends on https://github.com/signadot/signadot/pull/5941/files and it's corresponding SDK release
sequenceDiagram participant CLI as CLI Command participant API as API Client participant Auth as Auth Service participant Keyring as System Keyring Note over CLI,Keyring: Flow starts when any CLI command is executed CLI->>API: init() API->>Auth: ResolveAuth() Auth->>Keyring: Get stored auth info Keyring-->>Auth: Return auth info Auth-->>API: Return ResolvedAuth alt No auth found API-->>CLI: Return AuthNoFoundError else Auth exists API->>API: checkKeyringAuth() alt Token is expired && has refresh token API->>API: refreshKeyringAuth() API->>Auth: AuthDeviceRefreshToken API call Auth-->>API: New tokens (access + refresh) API->>Keyring: StoreAuthInKeyring(new tokens) API-->>CLI: Continue with refreshed tokens else Token is expired && no refresh token API-->>CLI: Return AuthExpiredError else Token is valid API-->>CLI: Continue with existing token end endLittle bit graphic usage