Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement passwordless login [SDK-1185] #330

Merged
merged 2 commits into from
Jan 3, 2020
Merged

Conversation

Widcket
Copy link
Contributor

@Widcket Widcket commented Jan 2, 2020

Changes

Added

login(email:code:audience:scope:parameters:)

Logs in a user using an email and an OTP code received via email (last part of the passwordless login flow)

Auth0
   .authentication(clientId: clientId, domain: "samples.auth0.com")
   .login(email: "support@auth0.com", code: "123456")
   .start { result in
       switch result {
       case .success(let credentials):
           print(credentials)
       case .failure(let error):
           print(error)
       }
   }

You can also specify audience, scope, and additional parameters

Auth0
   .authentication(clientId: clientId, domain: "samples.auth0.com")
   .login(email: "support@auth0.com",
        code: "123456",
        audience: "https://myapi.com/api",
        scope: "openid email",
        parameters: ["state": "a random state"])
   .start { print($0) }

login(phoneNumber:code:audience:scope:parameters:)

Logs in a user using a phone number and an OTP code received via sms (last part of the passwordless login flow)

Auth0
   .authentication(clientId: clientId, domain: "samples.auth0.com")
   .login(phoneNumber: "+4599134762367", code: "123456")
   .start { result in
       switch result {
       case .success(let credentials):
           print(credentials)
       case .failure(let error):
           print(error)
       }
   }

You can also specify audience, scope, and additional parameters

Auth0
   .authentication(clientId: clientId, domain: "samples.auth0.com")
   .login(phoneNumber: "+4599134762367",
        code: "123456",
        audience: "https://myapi.com/api",
        scope: "openid email",
        parameters: ["state": "a random state"])
   .start { print($0) }

Testing

  • This change adds unit test coverage
  • This change has been tested on the latest version of the platform/language or why not

Checklist

@Widcket Widcket added this to the vNext milestone Jan 2, 2020
@Widcket Widcket requested a review from a team January 2, 2020 20:19
Copy link
Contributor

@joshcanhelp joshcanhelp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great so far! Mostly questions, a couple of tiny changes and a few questions for you.

Auth0/Auth0Authentication.swift Show resolved Hide resolved
Auth0/Authentication.swift Outdated Show resolved Hide resolved
Auth0/Authentication.swift Outdated Show resolved Hide resolved
Auth0/Authentication.swift Show resolved Hide resolved
Auth0/Authentication.swift Show resolved Hide resolved
Auth0/Authentication.swift Outdated Show resolved Hide resolved
Auth0Tests/AuthenticationSpec.swift Outdated Show resolved Hide resolved
Auth0Tests/AuthenticationSpec.swift Show resolved Hide resolved
Auth0Tests/AuthenticationSpec.swift Outdated Show resolved Hide resolved
Auth0Tests/AuthenticationSpec.swift Show resolved Hide resolved
Copy link
Contributor

@joshcanhelp joshcanhelp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great and thank you for the thorough answers!

@Widcket Widcket merged commit 34d128b into master Jan 3, 2020
@Widcket Widcket deleted the feature/passwordless branch January 3, 2020 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants