How to fix post-redirect authentication errors for returning Google OAuth users? Answered

Post author
Bas Rijnen

Integrated google authentication today. Signing up is working properly now, however when I log in with an account which has signed up with google, this error is returned after the redirect. Anybody knows what's up here?

Comments

19 comments

  • Comment author
    Josh Lopez

    Hey Bas Rijnen πŸ‘‹

    What is your url so we can look at this further?

    0
  • Comment author
    Bas Rijnen

    Josh Lopez https://sleak.chat

    To replicate, first sign up through google auth, then skip onboarding and navigate to /dashboard to log out. Finally, log in with the same google account via /login

    0
  • Comment author
    Tyler Bell

    Bas Rijnen https://www.loom.com/share/5e585a88cf30461f9902d9b12fc8e802

    0
  • Comment author
    Bas Rijnen

    Hi Tyler Bell, thanks for looking into it.

    I removed the value of this field, and indeed after removing it I was able to log in.

    However, I don't see this as a proper solution as next to this field (which is automatically generated and filled by Zapier after sign-up), there are multiple other rich text area input fields which need to be filled in by our users with multi-line input.

    I never had any trouble with these fields anywhere in my application before, so wouldn't this rather be an issue with the Google auth integration?

    Now, all fields are returned after Google Auth redirect. Is this necessary? If these fields are just removed from the payload the problem would be solved right?

    Tyler Bell Could you guys look into this? : )

    It's kind of a big struggle for us at the moment, users we paid for are signing up and they can't log in atm. πŸ™

    0
  • Comment author
    Tyler Bell

    Bas Rijnen Sorry for the slow reply here.
    This is on my list to address today.

    0
  • Comment author
    Bas Rijnen

    No problem! Was just checking in πŸ™‚

    And that is great - thank you very much.

    0
  • Comment author
    Tyler Bell

    We just replicated the issue on our end.

    Working on a fix now.

    Bas Rijnen problem should be fixed now πŸ™‚

    0
  • Comment author
    Bas Rijnen

    Ah that's perfect!! Thank you very much for the fix πŸ™

    Tyler Bell So 1 more thing, the first name seems to not get passed into MS. Can it be that I have incorrectly set up my Google 0Auth?

    0
  • Comment author
    Tyler Bell

    Do you have a name or first-name field in Memberstack?

    The key has to be exact.

    0
  • Comment author
    Bas Rijnen

    Tyler Bell I'm using first-name in my regular signup fields. But this is independent from the google auto right?

    Or is it not possible to pass first name only with Google?

    It's quite unfortunate because when only passing full name, personalisation (dashboard, e-mail flows) is not really possible

    Tyler Bell Do you think this would be possible? Perhaps with a workaround

    0
  • Comment author
    Tyler Bell
    export const getCompatibleFields = (customFields: CustomField[], userInfo: userInfo) => {
    const fields = {}
    if (userInfo.name && customFields.some((field) => { return field.key === "name" })) {
    fields["name"] = userInfo.name
    }

    const hasFields = customFields.some((field) => { return field.key === "first-name" || field.key === "last-name" });

    if ((userInfo.given_name || userInfo.family_name) && hasFields) {
    fields["first-name"] = userInfo.given_name
    fields["last-name"] = userInfo.family_name
    }

    //@ts-ignore
    if ((userInfo.first_name || userInfo.last_name) && hasFields) {
    //@ts-ignore
    fields["first-name"] = userInfo.first_name
    //@ts-ignore
    fields["last-name"] = userInfo.last_name
    }

    return fields
    }

    This is the function in our system that pairs social auth fields to custom fields.
    Based on that, if you do have a first-name field, I’d expect it to equal the given_name provided by the auth provider.

    In your app (associated with https://www.sleak.chat/), I don’t see a first-name custom field πŸ€”

    0
  • Comment author
    Bas Rijnen

    Thanks!

    And I think I understand now. I was in fact already using both first-name and last-name, however they were just added in WF through a component from a MS template. We just never added it as a custom field in the MS dashboard. They were already pushed in json objects of members though (for instance through Zapier), so we already used them in mail automations etc. I just added the custom fields in the MS backend as well, and now it's working πŸ™‚

    0
  • Comment author
    Tyler Bell

    Yay!

    0
  • Comment author
    Lorand Bodo

    Hi everyone, I tried to configure the OAuth for Google. I followed the video instructions and used 'memberstack.com' as authorized domain but it doesn't allow it. It says I should use the domain where our site is hosted. Any tips? Cheers

    0
  • Comment author
    Chukwudi Onyekwere

    Hi Lo,

    For example, if your site is hosted at 'www.lo.com', you should also use this as the authorized domain in the Google Developer Console.

    If the issue persists after adding your domain to the Google console, kindly share a Loom video of your Google Developer console setup and your Memberstack Settings.

    0
  • Comment author
    Lorand Bodo

    awesome thanks! will try

    0
  • Comment author
    HO Chris

    Hi all!

    I am facing a problem while signing up via google auth with the result of 403 error, and the google account is blocked when clicking the button of google sign up.

    I have no idea what is goin on since I have activated the google auth.

    Thanks everyone in advance!

    0
  • Comment author
    Raquel Lopez

    Hi,

    A little hard to help you debug having to read a different language πŸ˜…

    Have you tried to Google the error? If I look up 403 sign in error the documentation says that the user that you're using might have a blockage like being set as under age or maybe not enabled to log in as a test user. Could you review your project and test user settings?

    Official documentation: https://support.google.com/accounts/answer/12917337?hl=en#zippy=%2Caccess-denied
    Stack Overflow Solution https://stackoverflow.com/a/66054825

    0
  • Comment author
    HO Chris

    Thanks for help Raquel Lopez!

    I turn back to Google cloud console, turning the status of testing into production mode and then it works.

    Guessing I activated google auth while testing mode in memberstack, and should go back console to turn it on as production status after upgrade memberstack.

    Thank you!

    0

Please sign in to leave a comment.