pbteja1998 / remix-auth-google

MIT License
88 stars 15 forks source link

Specify that you must return a value in the second parameter of authenticator.use #24

Open BryceBlankinship opened 5 months ago

BryceBlankinship commented 5 months ago

    new GoogleStrategy({
        clientID: process.env.GOOGLE_OAUTH_CLIENT_ID,
        clientSecret: process.env.GOOGLE_OAUTH_CLIENT_SECRET,
        callbackURL: process.env.BASE_URL + '/auth/google/callback'
    },
        async ({ accessToken, refreshToken, extraParams, profile }) => {
            //TODO: create the user in the database!
            console.log(profile.emails[0].value)
            return profile.emails[0].value; << here
        })
)```

I was trying to figure out why it wasn't working for the longest time. I didn't have the database setup yet, so I didn't return a value in the second param of authenticator.use(). Turns out all I had to do to get this working (with any strategy, so it has to do with the parent repo remix-auth) was to return a value. Please add this to the documentation somewhere!! Or I can do it myself I just don't feel like it at the moment lol
troutgirl commented 3 months ago

Can I ask whether you had any error messages during your build step complaining about a lack of export:

app/routes/auth.google.callback.tsx (3:9): "authenticator" is not exported by "app/services/auth.server.ts", imported by "app/routes/auth.google.callback.tsx".

BryceBlankinship commented 3 months ago

I can't remmber, but I believe there was no error which is probably why I opened the issue; so there's visibility to others who may encounter the same problem in the future.