django-rest-framework-social-oauth2 icon indicating copy to clipboard operation
django-rest-framework-social-oauth2 copied to clipboard

create_user() missing 2 required positional arguments: 'name' and 'password'

Open gebolisasi opened this issue 4 years ago • 5 comments

I want to make social auth and get name and email from google sign in. I've been adding an extra scope

SOCIAL_AUTH_GOOGLE_OAUTH2_SCOPE = ['https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile', 'openid']

but, after trying to convert-token, i got an error

TypeError at /v1/oauth2/convert-token/
create_user() missing 2 required positional arguments: 'name' and 'password'

and this is create_user function

class UserManager(BaseUserManager):
    def create_user(self, name, email, password, **extra_fields):
        if not name:
            raise ValueError(_('The name field must be set'))
        if not email:
            raise ValueError(_('The email field must be set'))

        email = self.normalize_email(email)

        user = self.model(name=name, email=email, **extra_fields)
        user.set_password(password)
        user.save()

        return user

Is there any mistake?

gebolisasi avatar Apr 01 '20 13:04 gebolisasi

Hi all.

My team and I are constantly using this framework and it seems it has died out there. I contacted the owner by email asking if he would add some of us as maintainers so we could continue to improve it. However we didn't get a response.

I am publishing the project under my profile and we are going to continue to invest time in it.

So I would like to gently ask you to contribute to this project on: https://github.com/wagnerdelima/drf-social-oauth2

Thank you for understanding.

wagnerdelima avatar Jul 04 '20 15:07 wagnerdelima

set default password to None

def create_user(self, name, email, password=None, **extra_fields):

after that user.set_password(password) will set a not usable password to the field automatically

hashinclude72 avatar Aug 28 '20 17:08 hashinclude72

set default password to None

def create_user(self, name, email, password=None, **extra_fields):

after that user.set_password(password) will set a not usable password to the field automatically

I have a similar error, and I still have the same error, is there any other way to fix it ?

KarimaMarina avatar May 12 '22 13:05 KarimaMarina

@KarimaMarina this framework is bugged. Please use https://github.com/wagnerdelima/drf-social-oauth2/ instead. If the error persists please let me know.

wagnerdelima avatar May 12 '22 14:05 wagnerdelima

hi, i have this error TypeError at /auth/user/ UserManager.create_user() takes from 2 to 4 positional arguments but 5 were given

kouamou29 avatar Apr 23 '23 12:04 kouamou29