User Creation flow with sso

@dasniko
When user tries to login via sso

  1. check if a user with same email exist or throw error
  2. if a user with that email exist and identity provider details are not saved, then save that and login the user
  3. if the identity providers details are already saved then login the user

can you please provide a sample to implement this flow.

below is the default flow