diff --git a/authentication/authentication_error.go b/authentication/authentication_error.go index 409ef150..a262c2ed 100644 --- a/authentication/authentication_error.go +++ b/authentication/authentication_error.go @@ -43,7 +43,11 @@ func (a *Error) Error() string { return fmt.Sprintf("%d %s: %s", a.StatusCode, a.Err, a.Message) } +// GetMFAToken returns the MFA token associated with the error, if any. func (a *Error) GetMFAToken() string { + if a == nil || a.MFAToken == "" { + return "" + } return a.MFAToken }