@@ -118,129 +118,6 @@ extension ErrorCode {
118118}
119119
120120public enum AuthError : LocalizedError , Equatable {
121- @available (
122- * ,
123- deprecated,
124- message:
125- " Error used to be thrown when no exp claim was found in JWT during setSession(accessToken:refreshToken:) method. "
126- )
127- case missingExpClaim
128-
129- @available (
130- * ,
131- deprecated,
132- message:
133- " Error used to be thrown when provided JWT wasn't valid during setSession(accessToken:refreshToken:) method. "
134- )
135- case malformedJWT
136-
137- @available ( * , deprecated, renamed: " sessionMissing " )
138- public static var sessionNotFound : AuthError { . sessionMissing }
139-
140- /// Error thrown during PKCE flow.
141- @available (
142- * ,
143- deprecated,
144- renamed: " pkceGrantCodeExchange " ,
145- message: " Error was grouped in `pkceGrantCodeExchange`, please use it instead of `pkce`. "
146- )
147- public static func pkce( _ reason: PKCEFailureReason ) -> AuthError {
148- switch reason {
149- case . codeVerifierNotFound:
150- . pkceGrantCodeExchange( message: " A code verifier wasn't found in PKCE flow. " )
151- case . invalidPKCEFlowURL:
152- . pkceGrantCodeExchange( message: " Not a valid PKCE flow url. " )
153- }
154- }
155-
156- @available ( * , deprecated, message: " Use `pkceGrantCodeExchange` instead. " )
157- public enum PKCEFailureReason : Sendable {
158- /// Code verifier not found in the URL.
159- case codeVerifierNotFound
160-
161- /// Not a valid PKCE flow URL.
162- case invalidPKCEFlowURL
163- }
164-
165- @available ( * , deprecated, renamed: " implicitGrantRedirect " )
166- public static var invalidImplicitGrantFlowURL : AuthError {
167- . implicitGrantRedirect( message: " Not a valid implicit grant flow url. " )
168- }
169-
170- @available (
171- * ,
172- deprecated,
173- message:
174- " This error is never thrown, if you depend on it, you can remove the logic as it never happens. "
175- )
176- case missingURL
177-
178- @available (
179- * ,
180- deprecated,
181- message:
182- " Error used to be thrown on methods which required a valid redirect scheme, such as signInWithOAuth. This is now considered a programming error an a assertion is triggered in case redirect scheme isn't provided. "
183- )
184- case invalidRedirectScheme
185-
186- @available (
187- * ,
188- deprecated,
189- renamed: " api(message:errorCode:underlyingData:underlyingResponse:) "
190- )
191- public static func api( _ error: APIError ) -> AuthError {
192- let message = error. msg ?? error. error ?? error. errorDescription ?? " Unexpected API error. "
193- if let weakPassword = error. weakPassword {
194- return . weakPassword( message: message, reasons: weakPassword. reasons)
195- }
196-
197- return . api(
198- message: message,
199- errorCode: . unknown,
200- underlyingData: ( try ? AuthClient . Configuration. jsonEncoder. encode ( error) ) ?? Data ( ) ,
201- underlyingResponse: HTTPURLResponse (
202- url: defaultAuthURL,
203- statusCode: error. code ?? 500 ,
204- httpVersion: nil ,
205- headerFields: nil
206- ) !
207- )
208- }
209-
210- /// An error returned by the API.
211- @available (
212- * ,
213- deprecated,
214- renamed: " api(message:errorCode:underlyingData:underlyingResponse:) "
215- )
216- public struct APIError : Error , Codable , Sendable , Equatable {
217- /// A basic message describing the problem with the request. Usually missing if
218- /// ``AuthError/APIError/error`` is present.
219- public var msg : String ?
220-
221- /// The HTTP status code. Usually missing if ``AuthError/APIError/error`` is present.
222- public var code : Int ?
223-
224- /// Certain responses will contain this property with the provided values.
225- ///
226- /// Usually one of these:
227- /// - `invalid_request`
228- /// - `unauthorized_client`
229- /// - `access_denied`
230- /// - `server_error`
231- /// - `temporarily_unavailable`
232- /// - `unsupported_otp_type`
233- public var error : String ?
234-
235- /// Certain responses that have an ``AuthError/APIError/error`` property may have this property
236- /// which describes the error.
237- public var errorDescription : String ?
238-
239- /// Only returned when signing up if the password used is too weak. Inspect the
240- /// ``WeakPassword/reasons`` and ``AuthError/APIError/msg`` property to identify the causes.
241- public var weakPassword : WeakPassword ?
242- }
243-
244121 /// Error thrown when a session is required to proceed, but none was found, either thrown by the client, or returned by the server.
245122 case sessionMissing
246123
@@ -274,11 +151,6 @@ public enum AuthError: LocalizedError, Equatable {
274151 let . implicitGrantRedirect( message) ,
275152 let . jwtVerificationFailed( message) :
276153 message
277- // Deprecated cases
278- case . missingExpClaim: " Missing expiration claim in the access token. "
279- case . malformedJWT: " A malformed JWT received. "
280- case . invalidRedirectScheme: " Invalid redirect scheme. "
281- case . missingURL: " Missing URL. "
282154 }
283155 }
284156
@@ -289,8 +161,6 @@ public enum AuthError: LocalizedError, Equatable {
289161 case let . api( _, errorCode, _, _) : errorCode
290162 case . pkceGrantCodeExchange, . implicitGrantRedirect: . unknown
291163 case . jwtVerificationFailed: . invalidJWT
292- // Deprecated cases
293- case . missingExpClaim, . malformedJWT, . invalidRedirectScheme, . missingURL: . unknown
294164 }
295165 }
296166
0 commit comments