Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: return failed refresh errors on external auth as string (was boolean)#13402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Emyrk merged 6 commits intomainfromstevenmasley/failed_refresh
Jun 3, 2024

Conversation

@Emyrk
Copy link
Member

@EmyrkEmyrk commentedMay 29, 2024
edited
Loading

Failed refreshing of tokens should return the error for debugging. The function no longer returns a boolean, and only returns an error. So the error can be checked if it is a validation error, or a runtime error.

This was added because multiple reports of failed refreshes have occurred. Debugging these failures are extremely difficult since errors are silenced. This will begin to raise said errors.

We might want to clean up errors from IDPs in the future if they get a bit too technical in their verbage.

Failed refreshes should return errors. These errors are capturedas validate errors. A fair classification of the the error
Copy link
Member

@kylecarbskylecarbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'd change this to be of a custom error type:ErrRefreshFailed and store the validation error there. It may be useful in the future as well if we want to store other properties.

@Emyrk
Copy link
MemberAuthor

I'd change this to be of a custom error type:ErrRefreshFailed and store the validation error there. It may be useful in the future as well if we want to store other properties.

I was considering that too, I just dislike that I would need to return anerror, when really none should be returned. Just thefalse.

If I was to go that route, I'd remove the boolean return entirely. Just

func (c *Config) RefreshToken(ctx context.Context, db database.Store, externalAuthLink database.ExternalAuthLink) (database.ExternalAuthLink, error)

Let me give that a go with a custom error type and see how it looks

@EmyrkEmyrk requested a review fromkylecarbsMay 31, 2024 14:56
@kylecarbs
Copy link
Member

Sweet!


// InvalidTokenError is a case where the "RefreshToken" failed to complete
// as a result of invalid credentials. Error contains the reason of the failure.
typeInvalidTokenErrorstring
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

nit: might wanna make this a struct instead, just so we can doe.ValidationMessage or something!

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It's more anInvalidationMessage, but more specifically it could be related to refreshing, a deployment configuration (disabled refreshes), or a validation error.

In all cases, it is anerror. And the error is related to being invalid for w/e reason. I think continuing to use it as anerr.Error() makes sense

@EmyrkEmyrk merged commit24ba819 intomainJun 3, 2024
@EmyrkEmyrk deleted the stevenmasley/failed_refresh branchJune 3, 2024 14:33
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsJun 3, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@kylecarbskylecarbskylecarbs approved these changes

Assignees

@EmyrkEmyrk

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@Emyrk@kylecarbs

[8]ページ先頭

©2009-2025 Movatter.jp