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

    post_logout_redirect_uri not working

    Scheduled Pinned Locked Moved
    Q&A
    0
    10
    25.4k
    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.
    • F
      fred.fred
      last edited by

      We are setting this post_logout_redirect_uri on our log off:

      https://auth.apps-d.XXX.com/oauth2/logout?post_logout_redirect_uri=http%3A%2F%2Flocalhost%3A12620%2F&x-client-SKU=ID_NET461&x-client-ver=5.3.0.0

      Which is http://localhost:12620/

      However, FusionAuth is just redirecting to its own root url: https://auth.apps-d.XXX.com/ instead of the post_logout_redirect_uri

      Referring to this post: https://fusionauth.io/community/forum/topic/35/is-there-a-way-to-have-a-user-who-logs-out-of-an-application-go-back-to-wherever-they-started-from-at-login

      It says the logout redirect url must be an authorized redirect url, which it is:

      24ad00f1-f0f5-4d37-bcbc-5d433be01c76-image.png

      However, FusionAuth is not redirecting as you can see from this debug session and is just going to root url instead of post_logout_redirect_uri

      f1ec3775-7caf-44e2-ba7c-6a0a521872f8-image.png

      How do we get FusionAuth to redirect to the passed post_logout_redirect_uri ??

      Thanks.

      1 Reply Last reply Reply Quote 1
      • F
        fred.fred
        last edited by

        @fred-fred said in post_logout_redirect_uri not working:

        http://localhost:12620/

        Note, we have also tried setting this localhost address as the Logout URL and we got the same redirect to the root of FusionAuth:

        f739df1e-e1f0-495b-8ae5-c7691189b20b-image.png

        1 Reply Last reply Reply Quote 0
        • A
          alexander.schamne
          last edited by

          Same behaviour here as well, just frustrating. It works when I pass the client_id, but it says it is an optional Parameter. I use the oidc-client javascript library and I can pass the client_id by setting the extraQuery parameter, but then it fail during login, because FusionAUth cannot handle a queryParameter, which is send twice. Frustrating!

          1 Reply Last reply Reply Quote 0
          • F
            fred.fred
            last edited by

            @alexander-schamne thanks.

            I tried your solution of adding the client id and the tenant id to the post_logout_redirect_uri and the redirection still did not work

            This is how my post_logout_redirect_uri looks now:

            https://auth.apps-d.XXX.com/oauth2/logout?
            post_logout_redirect_uri=http://localhost:12620
            &client_id=61c45c9a-XXX //My application's client id
            &tenantId=e1809405-YYY //My FA tenant id
            &x-client-SKU=ID_NET461&x-client-ver=5.3.0.0

            It still redirects to the root - https://auth.apps-d.XXX.com/

            To anyone on the FusionAuth team, how do we debug or fix this issue?

            The FA debug log for the application only shows the login and not the log out.

            BTW, I forgot to add in my post, this is how I am logging out the user:

            67c77abf-93ee-44d7-b763-270a28085f64-image.png

            This code block kills off the cookies and session for the FA login.

            Note: If I add an explicit redirect to this code, such as:

            3dd2d9c3-5205-4085-973a-aed346fbb3fa-image.png

            I still redirect to the root of my FA instance.

            1 Reply Last reply Reply Quote 0
            • F
              fred.fred
              last edited by

              FusionAuth team, I think I see the issue.

              On log out, my log out url string is this:

              https://auth.apps-d.XXX.com/oauth2/logout?post_logout_redirect_uri=http%3A%2F%2Flocalhost%3A12620%26client_id%3D61c45c9a-XXX%26tenantId%3De1809405-YYY&x-client-SKU=ID_NET461&x-client-ver=5.3.0.0

              If it runs like this, it just redirects to root:

              9a1b0107-dd4b-4f90-9de5-8735495687d3-image.png

              Now if I url decode it to:

              https://auth.apps-d.XXX.com/oauth2/logout?post_logout_redirect_uri=http%3A%2F%2Flocalhost%3A12620**&client_id=**61c45c9a-XXX%26tenantId%3De1809405-YYY&x-client-SKU=ID_NET461&x-client-ver=5.3.0.0

              Where the ampersand, client id, and equal sign are now &client_id=, the log off and redirection works fine.

              I think I can play with encoding, but is there a setting in FA for it to be able to parse an encoded &client_id= ?

              M 1 Reply Last reply Reply Quote 0
              • A
                alexander.schamne
                last edited by

                @fred-fred
                Does it also work if you don't pass the client_id to the logout process? I cannot pass the client_id because I use a oidc-client to logout and the client_id, which FusionAuth expects (beside the fact, that the documentaion says its "optional"), is not by oid standard. So the library doesn't support it.

                F 1 Reply Last reply Reply Quote 0
                • M
                  maciej.wisniowski Power User @fred.fred
                  last edited by

                  @alexander-schamne with oidc-client you have UserManager object that gets client_id as a parameter. Not sure why you're passing it as an extra parameter? I have an app using oidc-client with FA and it works properly for me.

                  @fred-fred I don't think there is any setting that would parse encoded client_id from the query string. For me, it would not make much sense to have something like that. The issue is that the parameters are passed incorrectly so you need to fix the code that constructs such URL and it will work.

                  1 Reply Last reply Reply Quote 0
                  • A
                    alexander.schamne
                    last edited by

                    @maciej-wisniowski
                    Ok let me explain it to you again, maybe it was not clear enough.

                    YES the client_id is passed as a parameter to the UserManager of client as well as the post_logout_redirect_url. I do not pass any handmade parameters.

                    see:
                    f4f1ff9e-0e4c-4d68-8132-142d7d13363f-image.png

                    1. The oidc-client uses the client_id to get the token, and it works!
                    2. The oidc-client uses the post_logout_redirect_url for logout, BUT the fusionauth ignores it and readirects me to the auth root. The client_id is not sent here by the oidc-client, as by OID default standard.

                    SO I tried manually to send the so called in the FusionAuth Documentaion "optinal" parameter: client_id for the logout AND taaaadaaaa it works - the FusionAuth redirects to the passed post_logout_redirect_uri Looks that FusionAuth expects beside the post_logout_redirect_uri also the client_id for logout BUT i cannot set the client_id in the oidc-client library for the logout process, because it is not by standard.

                    Now clear?!

                    1 Reply Last reply Reply Quote 1
                    • F
                      fred.fred @alexander.schamne
                      last edited by

                      @alexander-schamne - if you don't pass the client_id it doesn't do anything but redirect to root

                      1 Reply Last reply Reply Quote 0
                      • F
                        fred.fred
                        last edited by

                        Ok this is how I fixed the post_logout_redirect_uri issue.

                        In my logoff method, I did this to remove the local cookies

                        c99db979-5e36-4e07-8cbd-8ce25bd73775-image.png

                        Then because I could not use the Owin..OIDC..PostLogoutRedirectUri in the OpenIdConnectAuthenticationOptions to pass the client_id

                        At the end of the logoff method, I just did this:

                        39f0427a-f30a-4e54-b719-1c6689476674-image.png

                        This removed the FusionAuth session, does the log out, and redirects to my home page

                        Thanks to all who tried to help out

                        1 Reply Last reply Reply Quote 1
                        • First post
                          Last post