Allow Google or Auth0 users to register with an onBeforeRegistration hook

Problem

OAuth login works for existing users, but new users receive User not authorized to register.

Solution

Configure the onBeforeRegistration hook to return true. This explicitly permits registration for users authenticating through Google or Auth0.

Thread Attachments


Original Slack Thread

User U097MPHKU11: Hi, I was working on implementing *“Sign up with Google”* and *“Login with Google.” and facing an issue .* 
Login with Google is working only when the user is already registered. It allows the user to log in without entering their password. However, Sign up with Google always throws an error with the message *“User not authorized to register.”*
Later, we also tried using Auth0, but we faced the same issue there as well. The documentation also doesn't have any guide for creating a new user using Google or Auth0.
```{
    "action": "path",
    "options": {
        "sameWindow": true,
        "url": "/oauth/auth0"
    }
}```
User UBBJX2EHM: To allow the user to register watch the hook onBeforeRegistration. It needs to return true. 
User U097MPHKU11: Thanks, that part is done.
I just wanted to ask if there is any way to get rid of this interface and directly redirect the user to *“Continue with Google” screen .* 
User UBBJX2EHM: if you are just using google dont bother with Autho, and then you skip that all together. Auth) has a setting that can auto continue also, you will need to google