I’m working on a project that uses some urls that contains int refering to the primary key of an item.
As I’m looking into user authentication, I’ve noticed that PasswordResetView from django.contrib.auth uses a base64 encoding of the user id:
Email template context:
user.emailuser: The currentUser, according to theUser.is_active is True).site_name: An alias forsite.name. If you don’t have the site framework installed, this will be set to the value ofrequest.META['SERVER_NAME']. For more on sites, see The “sites” framework.domain: An alias forsite.domain. If you don’t have the site framework installed, this will be set to the value ofrequest.get_host().protocol: http or httpsuid: The user’s primary key encoded in base 64.token: Token to check that the reset link is valid.
I’ve done some research on the potential benefit of using base64 encoding in a url and all I could find is that it’s sometimes preferable to use text rather than binary data.
This argument seems a bit weak however, since Django can handle int in a path (e.g. path('edit-item/<str:class_name>/<int:pk>/', edit_item, name='edit-item').
So my question is: what is the point of using base64 encoding in a url?
Does it have to do with large numbers by any chance?
Any help appreciated!