Something went wrong. Try again.
Monorepo for Tangled
Something went wrong. Try again.
Go
at sl/comment
1234567891011121314151617181920212223package oauth
import "regexp"
var ( permanentAuthErrorRe = regexp.MustCompile(`\b(invalid_grant|invalid_client|unauthorized_client)\b`) staleAccessTokenErrRe = regexp.MustCompile(`HTTP 401\b.*(AuthenticationRequired|Invalid OAuth access token|invalid_token)`))
func IsPermanentAuthErr(err error) bool { if err == nil { return false } return permanentAuthErrorRe.MatchString(err.Error())}
func IsStaleAccessTokenErr(err error) bool { if err == nil { return false } return staleAccessTokenErrRe.MatchString(err.Error())}