@@ -165,7 +165,140 @@ public protocol Authentication: SenderConstraining, Trackable, Loggable, Sendabl
165165 */
166166 func login( usernameOrEmail username: String , password: String , realmOrConnection realm: String , audience: String ? , scope: String ) -> Request < Credentials , AuthenticationError >
167167
168- /**
168+ /**
169+ Verifies multi-factor authentication (MFA) using a one-time password (OTP).
170+
171+ ## Usage
172+
173+ ```swift
174+ Auth0
175+ .authentication()
176+ .login(withOTP: "123456", mfaToken: "mfa-token")
177+ .start { result in
178+ switch result {
179+ case .success(let credentials):
180+ print("Obtained credentials: \(credentials)")
181+ case .failure(let error):
182+ print("Failed with: \(error)")
183+ }
184+ }
185+ ```
186+
187+ - Parameters:
188+ - otp: One-time password supplied by a MFA authenticator.
189+ - mfaToken: Token returned when authentication fails with an ``AuthenticationError/isMultifactorRequired`` error due to MFA requirement.
190+ - Returns: A request that will yield Auth0 user's credentials.
191+ - Requires: The `http://auth0.com/oauth/grant-type/mfa-otp` grant. Check
192+ [our documentation](https://auth0.com/docs/get-started/applications/application-grant-types) for more information.
193+
194+ ## See Also
195+
196+ - [Authentication API Endpoint](https://auth0.com/docs/api/authentication/muti-factor-authentication/verify-mfa-with-otp)
197+ */
198+ func login( withOTP otp: String , mfaToken: String ) -> Request < Credentials , AuthenticationError >
199+
200+ /// Verifies multi-factor authentication (MFA) using an out-of-band (OOB) challenge (either push notification, SMS
201+ /// or voice).
202+ ///
203+ /// ## Usage
204+ ///
205+ /// ```swift
206+ /// Auth0
207+ /// .authentication()
208+ /// .login(withOOBCode: "123456", mfaToken: "mfa-token")
209+ /// .start { result in
210+ /// switch result {
211+ /// case .success(let credentials):
212+ /// print("Obtained credentials: \(credentials)")
213+ /// case .failure(let error):
214+ /// print("Failed with: \(error)")
215+ /// }
216+ /// }
217+ /// ```
218+ ///
219+ /// - Parameters:
220+ /// - oobCode: The OOB code received from the challenge request.
221+ /// - mfaToken: Token returned when authentication fails with an ``AuthenticationError/isMultifactorRequired`` error due to MFA requirement.
222+ /// - bindingCode: A code used to bind the side channel (used to deliver the challenge) with the main channel you are using to authenticate. This is usually an OTP-like code delivered as part of the challenge message.
223+ /// - Returns: A request that will yield Auth0 user's credentials.
224+ /// - Requires: The `http://auth0.com/oauth/grant-type/mfa-oob` grant. Check
225+ /// [our documentation](https://auth0.com/docs/get-started/applications/application-grant-types) for more information.
226+ ///
227+ /// ## See Also
228+ ///
229+ /// - [Authentication API Endpoint](https://auth0.com/docs/api/authentication/muti-factor-authentication/verify-with-out-of-band)
230+ func login( withOOBCode oobCode: String , mfaToken: String , bindingCode: String ? ) -> Request < Credentials , AuthenticationError >
231+
232+ /// Verifies multi-factor authentication (MFA) using a recovery code.
233+ /// Some multi-factor authentication (MFA) providers support using a recovery code to login. Use this method to
234+ /// authenticate when the user's enrolled device is unavailable, or the user cannot receive the challenge or accept
235+ /// it due to connectivity issues.
236+ ///
237+ /// ## Usage
238+ ///
239+ /// ```swift
240+ /// Auth0
241+ /// .authentication()
242+ /// .login(withRecoveryCode: "recovery-code", mfaToken: "mfa-token")
243+ /// .start { result in
244+ /// switch result {
245+ /// case .success(let credentials):
246+ /// print("Obtained credentials: \(credentials)")
247+ /// case .failure(let error):
248+ /// print("Failed with: \(error)")
249+ /// }
250+ /// }
251+ /// ```
252+ ///
253+ /// - Parameters:
254+ /// - recoveryCode: Recovery code provided by the user.
255+ /// - mfaToken: Token returned when authentication fails with an ``AuthenticationError/isMultifactorRequired`` error due to MFA requirement.
256+ /// - Returns: A request that will yield Auth0 user's credentials. Might include a **recovery code**, which the
257+ /// application must display to the user to be stored securely for future use.
258+ /// - Requires: The `http://auth0.com/oauth/grant-type/mfa-recovery-code` grant. Check
259+ /// [our documentation](https://auth0.com/docs/get-started/applications/application-grant-types) for more information.
260+ ///
261+ /// ## See Also
262+ ///
263+ /// - ``Credentials/recoveryCode``
264+ /// - [Authentication API Endpoint](https://auth0.com/docs/api/authentication/muti-factor-authentication/verify-with-recovery-code)
265+ func login( withRecoveryCode recoveryCode: String , mfaToken: String ) -> Request < Credentials , AuthenticationError >
266+
267+ /// Requests a challenge for multi-factor authentication (MFA) based on the challenge types supported by the
268+ /// application and user.
269+ ///
270+ /// ## Usage
271+ ///
272+ /// ```swift
273+ /// Auth0
274+ /// .authentication()
275+ /// .multifactorChallenge(mfaToken: "mfa-token", types: ["otp"])
276+ /// .start { result in
277+ /// switch result {
278+ /// case .success(let challenge):
279+ /// print("Obtained challenge: \(challenge)")
280+ /// case .failure(let error):
281+ /// print("Failed with: \(error)")
282+ /// }
283+ /// }
284+ /// ```
285+ ///
286+ /// The challenge type is how the user will get the challenge and prove possession. Supported challenge types include:
287+ /// * `otp`: for one-time password (OTP)
288+ /// * `oob`: for SMS/voice messages or out-of-band (OOB)
289+ ///
290+ /// - Parameters:
291+ /// - mfaToken: Token returned when authentication fails with an ``AuthenticationError/isMultifactorRequired`` error due to MFA requirement.
292+ /// - types: A list of the challenges types accepted by your application. Accepted challenge types are `oob` or `otp`. Excluding this parameter means that your application accepts all supported challenge types.
293+ /// - authenticatorId: The ID of the authenticator to challenge. You can get the ID by querying the list of available authenticators for the user.
294+ /// - Returns: A request that will yield a multi-factor challenge.
295+ ///
296+ /// ## See Also
297+ ///
298+ /// - [Authentication API Endpoint](https://auth0.com/docs/api/authentication/muti-factor-authentication/request-mfa-challenge)
299+ func multifactorChallenge( mfaToken: String , types: [ String ] ? , authenticatorId: String ? ) -> Request < Challenge , AuthenticationError >
300+
301+ /**
169302 Logs a user in with their Sign In with Apple authorization code.
170303
171304 ## Usage
@@ -200,7 +333,7 @@ public protocol Authentication: SenderConstraining, Trackable, Loggable, Sendabl
200333 - authorizationCode: Authorization Code retrieved from Apple Authorization.
201334 - fullName: The full name property returned with the Apple ID Credentials.
202335 - profile: Additional user profile data returned with the Apple ID Credentials.
203- - audience: API Identifier that your application is requesting access to.
336+ - audience: API Identifier that your application is requesting access to.
204337 - scope: Space-separated list of requested scope values. Defaults to `openid profile email`.
205338 - Returns: A request that will yield Auth0 user's credentials.
206339
@@ -542,7 +675,7 @@ public protocol Authentication: SenderConstraining, Trackable, Loggable, Sendabl
542675 /// - Returns: A request that will yield Auth0 user's credentials.
543676 ///
544677 /// ## See Also
545- ///
678+ ///
546679 /// - [Authentication API Endpoint](https://auth0.com/docs/native-passkeys-api#authenticate-new-user)
547680 /// - [Native Passkeys for Mobile Applications](https://auth0.com/docs/native-passkeys-for-mobile-applications)
548681 /// - [Supporting passkeys](https://developer.apple.com/documentation/authenticationservices/supporting-passkeys#Register-a-new-account-on-a-service)
@@ -1035,6 +1168,14 @@ public extension Authentication {
10351168 return self . login ( usernameOrEmail: username, password: password, realmOrConnection: realm, audience: audience, scope: scope)
10361169 }
10371170
1171+ func login( withOOBCode oobCode: String , mfaToken: String , bindingCode: String ? = nil ) -> Request < Credentials , AuthenticationError > {
1172+ return self . login ( withOOBCode: oobCode, mfaToken: mfaToken, bindingCode: bindingCode)
1173+ }
1174+
1175+ func multifactorChallenge( mfaToken: String , types: [ String ] ? = nil , authenticatorId: String ? = nil ) -> Request < Challenge , AuthenticationError > {
1176+ return self . multifactorChallenge ( mfaToken: mfaToken, types: types, authenticatorId: authenticatorId)
1177+ }
1178+
10381179 func login( appleAuthorizationCode authorizationCode: String ,
10391180 fullName: PersonNameComponents ? = nil ,
10401181 profile: [ String : Any ] ? = nil ,
0 commit comments