FusionAuth / fusionauth-issues

FusionAuth issue submission project
https://fusionauth.io
90 stars 12 forks source link

Search Index not updating when a user logs in via OpenID connect #2796

Open lchauhan21 opened 4 days ago

lchauhan21 commented 4 days ago

Hi, we are encountering the following issue: We have two ways of registering to our system

When registering a user through username and password, the search index is updated properly. However, when registering a user with an OpenID connect identity provider, the search index is not updated. Unless we re-index, the user is not populated in the search index.

We are using Fusionauth 1.45.2. Attaching the two functions we use for registering both.

OpenID Connect

def register_user(user_data, user_id=None, tenant_id=None, application_id=None):
    # setting tenant ID to fusionauth client object
    client = set_tenant_id(tenant_id)
    application_id = (
        DEFAULT_APPLICATION_ID if application_id is None else application_id
    )
    user_registration_request = {
        "registration": {"applicationId": application_id, "data": user_data}
    }

    if not user_id:
        response = client.register(user_registration_request)
    else:
        response = client.register(user_registration_request, user_id)
    return response

Email and Password register

def register(
    username,
    first_name,
    last_name,
    password=None,
    email=None,
    mobilePhone=None,
    timezone=None,
    user_data=None,
    user_id=None,
    tenant_id=None,
    application_id=None,
    roles=[],
    memberships=None,
):
    # setting tenant ID to fusionauth client object
    client = set_tenant_id(tenant_id)
    application_id = (
        DEFAULT_APPLICATION_ID if application_id is None else application_id
    )
    user_registration_request = {
        "registration": {"applicationId": application_id, "roles": roles},
        "user": {
            "username": username,
            "firstName": first_name,
            "lastName": last_name,
            "timezone": timezone,
            "email": email,
            "mobilePhone": mobilePhone,
            "data": user_data,
        },
        "sendSetPasswordEmail": False,
        "skipVerification": False,
    }
    if password:
        user_registration_request["user"]["password"] = password

    if memberships:
        user_registration_request["user"]["memberships"] = memberships

    if not user_id:
        response = client.register(user_registration_request)
    else:
        response = client.register(user_registration_request, user_id)
    return response

Community guidelines

All issues filed in this repository must abide by the FusionAuth community guidelines.

mooreds commented 2 days ago

@lchauhan21 thanks for using FusionAuth!

Have you seen this behavior on the latest version of FusionAuth (1.51.1)?