Login: handle custom token creation error messages (#31283)

* Login: handle custom token creation errors

* Login: handle external error for OAuth responses
This commit is contained in:
Agnès Toulet
2021-02-25 15:30:51 +01:00
committed by GitHub
parent 8379f36a68
commit 663d44fe82
2 changed files with 31 additions and 3 deletions
+14
View File
@@ -11,6 +11,20 @@ var (
ErrUserTokenNotFound = errors.New("user token not found")
)
// CreateTokenErr represents a token creation error; used in Enterprise
type CreateTokenErr struct {
StatusCode int
InternalErr error
ExternalErr string
}
func (e *CreateTokenErr) Error() string {
if e.InternalErr != nil {
return e.InternalErr.Error()
}
return "failed to create token"
}
type TokenExpiredError struct {
UserID int64
TokenID int64