Skip to content

Feat: Adding email_login (legacy) and login to passwordless - #267

Closed
4x4notfound wants to merge 2 commits into
auth0:masterfrom
4x4notfound:master
Closed

4x4notfound wants to merge 2 commits into
auth0:masterfrom
4x4notfound:master

Conversation

@4x4notfound

@4x4notfound 4x4notfound commented Apr 12, 2021 •

Copy link
Copy Markdown

Changes

Please describe both what is changing and why this is important. Include:

  • add email_login_legacy to Passwordless
  • add login to Passwordless

References

Please include relevant links supporting this change such as a:

Testing

  • This change adds unit test coverage

Checklist

@4x4notfound
4x4notfound requested a review from a team as a code owner April 12, 2021 15:00
@4x4notfound 4x4notfound changed the title Feat: Adding email_login to passwordless Feat: Adding email_login (legacy) and login to passwordless Apr 13, 2021
@4x4notfound

Copy link
Copy Markdown
Author

this has been open for 2 days

fix: new newline at end of test file

docs: changelong and version bump

fix: typo

fix: more typos

feat: deprecate legacy passwordless login in favor of new grant type login

docs: updated changlog and docs

wip: code -> otp

fix: test

@lbalmaceda lbalmaceda left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the contribution. I left some comments. If you are going to resolve them, make sure to update the docs and tests to match what has changed. Let me know if you have questions!

Comment thread CHANGELOG.md Outdated
Comment thread auth0/__init__.py Outdated
}
)

def sms_login_legacy(self, client_id, phone_number, code, scope='openid'):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The passwordless login functionality is already covered by sms_login. What's this method for?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The API uses just login with a type parameter which I've added

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I went through this PR again. Let's remove this method sms_login_legacy and keep sms_login for compatibility purposes.

From now on, the documented way to consume the passwordless endpoint should be through the login method that you added.

data=data
)

def login(self,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You copy-pasted the "login for database" method signature. For passwordless there are parameters you don't require. The signature should take: client_id, email, code, scope where scope would have a default value of "openid".

Please, rename this method to email_login to match the existing SMS variant.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The API has a single endpoint for login. In this case setting the realm and the username (email or phone) will work. This method is a direct mapping to that.

The existing sms_login methods uses a different endpoint which is why I named and aliased it with legacy and didn't add an email_login

Comment thread auth0/v3/authentication/passwordless.py Outdated
@lbalmaceda lbalmaceda added the waiting for customer This issue is waiting for a response from the issue or PR author label Apr 19, 2021

@lbalmaceda lbalmaceda left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the changes and apologies for the delay. I think this PR is adding a bit of complexity to the existing API design, which I will grant you it's really old (+4 years).

I believe that the way the passwordless module of this library is today, exposing two separate methods for the SMS and email "start" step of the passwordless flow, should be followed by two separate methods for the SMS and email "completion" step of the passwordless flow. Adding a "generic" login method could be a bit confusing to our devs.

That said, it's been a long time since this PR and feature request has been opened. I'll accept the generic login method but not additional "legacy" methods. I left a comment to remove sms_login_legacy and to update the way we signal deprecation. You will have to update the tests as well.

Hopefully soon we can start looking into how the next major version of this SDK would look like. Once again, thanks for the contribution.

}
)

def sms_login_legacy(self, client_id, phone_number, code, scope='openid'):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I went through this PR again. Let's remove this method sms_login_legacy and keep sms_login for compatibility purposes.

From now on, the documented way to consume the passwordless endpoint should be through the login method that you added.

def sms_login(self, client_id, phone_number, code, scope='openid'):
"""Login using phone number/verification code.

Note: this method should be depcrecated in the future.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's print a warning instead (watch for the import)

See reference

warnings.warn("/tokeninfo will be deprecated in future releases", DeprecationWarning)

@lbalmaceda

Copy link
Copy Markdown
Contributor

Closing in favor of #279. Thanks for your contribution.

@lbalmaceda lbalmaceda closed this Aug 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting for customer This issue is waiting for a response from the issue or PR author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants