Automatically User Created and Logging Into Application

I have one application A1 that redirects the user to another application A2.

A2 is a nextjs application, which generally uses OAuth0 Universal login page for user authorization and authentication.
But now as A1 is redirecting to A2, A2 will get user name details in the request body, It will check if a user is already present in its owned Postgres database or not,
If it is not present in the database, It will create a user in auth0 and its Postgres database.

Once the user is created in postgess and auth0, it needs to be automatically logged into the A2 and redirected to its home page, i.e. A2 Application Home Page.
By this flow, the User can directly go to Application A2 from Application A1.

We know that we can create the user programmatically via Management APIs or Authentication APIs.
But how the login should be implemented once user creation is done.