Skip to content

NPE when creating user #9

@john-london

Description

@john-london

There is a NPE generated when creating a user as a result of the username field returned by FB being null (link below details this).

http://stackoverflow.com/questions/23957280/no-username-returned-in-facebook-profile/23986618#23986618

FacebookAuthService:

    String username = fbProfile.username // this is null, see link above, but username cannot be blank or nullable
    String firstName = fbProfile.firstName
    String lastName = fbProfile.lastName

    User person = new User(
            username: username,
            password: token.accessToken.accessToken, 
            enabled: true,
            accountExpired:  false,
            accountLocked: false,
            passwordExpired: false,

            //fill with data loaded from Facebook API
            name: [firstName, lastName].join(' '),
            email: email
    )
    person.save(failOnError: true) // if you add failOnError: true then the code will fail here and you see   the exception

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions