RealmTeam / django-rest-framework-social-oauth2

python-social-auth and oauth2 support for django-rest-framework
MIT License
1.06k stars 191 forks source link

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

Open gebolisasi opened 4 years ago

gebolisasi commented 4 years ago

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?

wagnerdelima commented 4 years ago

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.

hashinclude72 commented 4 years ago

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

KarimaMarina commented 2 years ago

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 ?

wagnerdelima commented 2 years ago

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

kouamou29 commented 1 year ago

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