FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    How to setup OAuth properly

    Scheduled Pinned Locked Moved Solved
    Q&A
    2
    23
    10.7k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mark.robustelliM
      mark.robustelli @altear147
      last edited by

      @altear147 OK, it looks like the redirect_uri does not match what is configured in the application. Can you make sure you are supplying the correct uri?

      This can be found under: Applications -> Edit -> OAuth tab

      Screenshot 2025-04-07 at 8.05.59 AM.png

      A 1 Reply Last reply Reply Quote 0
      • A
        altear147 @mark.robustelli
        last edited by

        @mark-robustelli

        redirect url is valid now, it takes me to this login page again, expect flow is using google oauth flow, but we made a progress.

        Screenshot 2568-04-08 at 11.41.30.png

        1 Reply Last reply Reply Quote 0
        • A
          altear147
          last edited by

          as I replied earlier I add redirect uri in FusionAuth console and invalid_redirect_uri is gone.

          and this moment still get this error using Google Oauth flow.

          Screenshot 2568-04-09 at 16.15.01.png

          I replaced redirect uri "https://mydomain/callback" as I did in Fusionauth admin console but still get the same error.

          mark.robustelliM 1 Reply Last reply Reply Quote 0
          • mark.robustelliM
            mark.robustelli @altear147
            last edited by mark.robustelli

            @altear147 looks like you are getting closer. If I go back to your screenshot of the provider configuration page, it looks like the scope input box is empty. Three common scopes to include are email, profile, and openid.. Please add the correct scope(s) and let me know if that works for you.

            A 2 Replies Last reply Reply Quote 0
            • A
              altear147 @mark.robustelli
              last edited by

              @mark-robustelli

              is this what you mentioned?

              Screenshot 2568-04-09 at 22.57.26.png

              I had added it a few days ago and it shows me this error

              Screenshot 2568-04-09 at 22.59.14.png

              Actually, we made a progress since a few days ago the error said I need to define scope.

              1 Reply Last reply Reply Quote 0
              • A
                altear147 @mark.robustelli
                last edited by

                @mark-robustelli

                and to be clear, the error dialog I posted above was from fusionauth admin console

                Screenshot 2568-04-09 at 23.05.07.png

                but if I call the request to this function

                @Get("oauth/login")
                async login(@Req() req: Request, @Res() res: Response) {
                const fusionAuthURL = ${process.env.FUSIONAUTH_ISSUER}/oauth2/authorize?client_id={secret}&response_type=code&redirect_uri=${"my redirect url"};
                return res.redirect(fusionAuthURL);
                }

                it still returns me
                {
                "error" : "invalid_client",
                "error_description" : "client_id: {secret} is not valid.",
                "error_reason" : "invalid_client_id"
                }

                mark.robustelliM 2 Replies Last reply Reply Quote 0
                • mark.robustelliM
                  mark.robustelli @altear147
                  last edited by

                  @altear147 Thanks for taking the time to work with this. It is generally a pretty straight forward process taking no more than 5 minutes. I am out of the office this week, but will try to get some time to replicate what you are going through. I want to make sure I am working on the right thing, so just want to confirm that we have the same end goal. You want the 'Login with Google' button to work for an Application you created within FusionAuth, right?

                  1 Reply Last reply Reply Quote 0
                  • mark.robustelliM
                    mark.robustelli @altear147
                    last edited by

                    @altear147 also did you grant these scopes in the google config?
                    Screenshot 2025-04-10 at 10.54.38 AM.png

                    A 3 Replies Last reply Reply Quote 0
                    • A
                      altear147 @mark.robustelli
                      last edited by

                      @mark-robustelli

                      thank you for replying.

                      My auth platform(Nest js) was implemented on top of FusionAuth in order to make some features for authentication and authorization.

                      and I do want to allow a new user to sign-in and access my platform without register by using sso feature.

                      I defined a login and callback function(as I've written above) for the web application using redirect method.


                      I also enable sign-in google button at the fusionauth admin in order to test the credential and as I showed you that I still encouter the invalid client error.

                      I believe that it's not that so complicated due to the document is easy to replicate but for some reasons I still get the error.


                      Lastly I havn't seen any section in credetial page that can define scope, may you tell me about this section.

                      1 Reply Last reply Reply Quote 0
                      • A
                        altear147 @mark.robustelli
                        last edited by

                        @mark-robustelli

                        oh, I saw the oauth consent screen but for some reason it redirect me to other page, looks like I'm not allowed to access this page.

                        but I don't think it was a root cause of my error due to the error kept showing me "invalid client id" in my redirect scenario and "redirect uri mismatch" in futionauth console scenario.

                        1 Reply Last reply Reply Quote 0
                        • A
                          altear147 @mark.robustelli
                          last edited by

                          @mark-robustelli

                          I think I did misunderstand after taking a look at the document again.

                          for this moment I can make a redirect login from my site and retrieve access token there is some issue left at my site. I will let you know after I solve those probs.

                          thank you for replying.

                          mark.robustelliM 1 Reply Last reply Reply Quote 0
                          • mark.robustelliM
                            mark.robustelli @altear147
                            last edited by

                            @altear147 Awesome that you are making progress and thanks for keeping the post updated. I'll keep an eye on the thread, and if other issues come up, let us know.

                            A 1 Reply Last reply Reply Quote 0
                            • A
                              altear147 @mark.robustelli
                              last edited by

                              @mark-robustelli

                              Hello, sorry for away from this topic for a week due to my other ad hoc job,

                              I've already solved this topic, it's not about setting on Fusionauth or google credential.

                              but it's because I used google's client id on Fusionauth callback and
                              after you told me to set applicationId in my Fusionauth admin then I used ApplicationId on google oauth's callback.

                              that's why it kept return me client id is invalid.

                              it was right under my nose, but I couldn't see it.

                              Thank you for reply me, that's very helpful, It would take more time if you didn't help me.

                              1 Reply Last reply Reply Quote 0
                              • mark.robustelliM mark.robustelli has marked this topic as solved
                              • First post
                                Last post