Exception: Supabase::Rails::AuthError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/supabase/rails/errors.rb

Constant Summary collapse

AUTH_GENERIC_ERROR =
"AUTH_ERROR"
INVALID_CREDENTIALS =
"INVALID_CREDENTIALS"
CREATE_SUPABASE_CLIENT_ERROR =
"CREATE_SUPABASE_CLIENT_ERROR"
REFRESH_UNAVAILABLE =
"REFRESH_UNAVAILABLE"
PKCE_ERROR =
"PKCE_ERROR"
WEAK_PASSWORD =
"WEAK_PASSWORD"
SESSION_MISSING =
"SESSION_MISSING"
INVALID_REDIRECT =
"INVALID_REDIRECT"
AUTH_API_ERROR =
"AUTH_API_ERROR"
AUTH_UPSTREAM_ERROR =
"AUTH_UPSTREAM_ERROR"
AUTH_RETRYABLE =
"AUTH_RETRYABLE"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, code = AUTH_GENERIC_ERROR, status = 401) ⇒ AuthError

Returns a new instance of AuthError.



97
98
99
100
101
# File 'lib/supabase/rails/errors.rb', line 97

def initialize(message, code = AUTH_GENERIC_ERROR, status = 401)
  super(message)
  @code = code
  @status = status
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



95
96
97
# File 'lib/supabase/rails/errors.rb', line 95

def code
  @code
end

#statusObject (readonly)

Returns the value of attribute status.



95
96
97
# File 'lib/supabase/rails/errors.rb', line 95

def status
  @status
end

Class Method Details

.create_supabase_client_errorObject



107
108
109
# File 'lib/supabase/rails/errors.rb', line 107

def self.create_supabase_client_error
  new("Failed to create Supabase client", CREATE_SUPABASE_CLIENT_ERROR, 500)
end

.invalid_credentialsObject



103
104
105
# File 'lib/supabase/rails/errors.rb', line 103

def self.invalid_credentials
  new("Invalid credentials", INVALID_CREDENTIALS, 401)
end

.invalid_redirect(uri) ⇒ Object



127
128
129
130
131
132
133
# File 'lib/supabase/rails/errors.rb', line 127

def self.invalid_redirect(uri)
  new(
    %(redirect target #{uri.inspect} is not in `config.supabase.allowed_redirect_origins`),
    INVALID_REDIRECT,
    400
  )
end

.pkce_missing_verifierObject



119
120
121
122
123
124
125
# File 'lib/supabase/rails/errors.rb', line 119

def self.pkce_missing_verifier
  new(
    "PKCE verifier missing or expired. Restart the OAuth flow.",
    PKCE_ERROR,
    400
  )
end

.refresh_unavailableObject



111
112
113
114
115
116
117
# File 'lib/supabase/rails/errors.rb', line 111

def self.refresh_unavailable
  new(
    "Supabase Auth is temporarily unavailable. Please try again.",
    REFRESH_UNAVAILABLE,
    503
  )
end

.session_missingObject



135
136
137
138
139
140
141
# File 'lib/supabase/rails/errors.rb', line 135

def self.session_missing
  new(
    "Authentication required. No active Supabase session.",
    SESSION_MISSING,
    401
  )
end