mcueto / djangorestframework-auth0

Library to simply use Auth0 token authentication in DRF within djangorestframework-jwt
MIT License
91 stars 19 forks source link

Why the separator is dot and not the pipe ? #24

Closed Calion54 closed 7 years ago

Calion54 commented 7 years ago

Hello,

I have a question: Why you save in the database, the username id with a dot and not a pipe ? (for exemple: auth0.103960867183444705964) In the old versions, you save with the pipe. My API request the Auth0 management api, so, I need replace character while it's not necessary.

snake575 commented 7 years ago

Hi, I made that change, the pipe is an illegal character in Django's username field (docs), that's why the pipe is replaced with a dot.

mcueto commented 7 years ago

@Snake575 did that cause a problem or it's just an interpretation of the docs?, what happen if a developer used this package before the change and the user now has 2 username(one with | and one with .)?

as far as i remember, it didn't cause me a problem, but i could be wrong...

PD: sorry if it sounds a little rude, it's not my intention

snake575 commented 7 years ago

Given the big Warning on the readme I didn't worry too much about that :satisfied:

I remember it causing problems to me and didn't understand why... then found that on the docs, changed it and the error was solved. I didn't test it extensively though.

mcueto commented 7 years ago

In the Django-Auth0 project they solved it in the same way but instead of replacing it with a . they replaced it with a -.

I suppose both solutions are correct.

@Calion54 cause it's an illegal character we must to replace this! sorry for this. And sorry if the update broke something in your system too.

Nice week for all contributors and users! Everyday we'll try to do our best!

Calion54 commented 7 years ago

Ok ! Indeed, I use DRF and auth0 for a lot of project and I would like upgrade for my new project and I don't understand why you are changed that.

Thank you for your answer :)

nmartinezb3 commented 6 years ago

If you create the user manually (e.g. in a view, not in the admin) with the pipe in the username it actually works. I create my users manually because I have a one-to-one model with the user where I store additional information of the user, and I dont want to change the pipes for dots in the usernames to avoid loosing consistency with the auth0 users.

I think it should be optional to change the pipes for dots, configurable in the settings vars.

image

mcueto commented 6 years ago

@nmartinezb3 creating the username with pipe can be done, BUT it isn't safe because of RFC2396 https://www.ietf.org/rfc/rfc2396.txt