Auth0 Home Blog Docs

Problem with Django SDK Quickstart - email too long for first_name field


#1

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!


#2

Hey @owend1, have you tried increasing the character size for the field in Postgres? I also found this stackoverflow response that may help as well. Please let me if this ends up helping you in your quest. Thanks!


#4

I wanted to touch base @owend1 and see if you had any remaining questions on this front? Thanks in advance.


#5

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.