I’ve used to Django SDK quickstart to get up and running with Auth0 and it works well. I’m using Django 2.1, and Postgres 10.
However, I’ve encountered one problem. If I create a user with a long email address (over 30 characters) in Auth0, and then use it to log into my Django app I get an error:
"DataError at /complete/auth0
value too long for type character varying(30)"
I have isolated this problem (I think) down to the fact that Django is trying to put a long email address into the first_name field on the main users table, which only allows 30 characters.
I have tried experimenting with the auth0backend.py file, as described by the tutorial. I’m assuming that the long name is injected here:
def get_user_details(self, response):
url = ‘https://’ + self.setting(‘DOMAIN’) + ‘/userinfo’
headers = {‘authorization’: 'Bearer ’ + response[‘access_token’]}
resp = requests.get(url, headers=headers)
userinfo = resp.json()return {'username': userinfo['nickname'], 'first_name': userinfo['name'], 'picture': userinfo['picture'], 'user_id': userinfo['sub']}
I’ve tried modifying the first_name field to use fewer characters (e.g. just the letters before the @ in the address), but this seems to fail.
How might I get this to work with longer email addresses?
Thanks!