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

    registration question sendSetPassword flow

    Scheduled Pinned Locked Moved
    General Discussion
    0
    7
    868
    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.
    • B
      bergraan
      last edited by

      Hello, at this time I'm trying to integrate my actual app with fusion auth to develop as new feature, I want to use an invitation feature that I have developed before and migrate it here. Then, on registration API I'm sending this JSON:

      {
        "registration": {
          "applicationId": <app_id>,
          "data": {
            "displayName": "Johnny",
            "favoriteSports": [
              "Football",
              "Basketball"
            ],
          },
          "id": user_uuid,
          "preferredLanguages": [
            "en",
            "fr"
          ],
          "timezone": "America/Chicago",
          "username": "johnny",
          "usernameStatus": "ACTIVE"
        },
        "sendSetPasswordEmail": true,
        "skipVerification": false,
        "user": {
          "birthDate": "1976-05-30",
          "data": {
            "displayName": "Johnny Boy",
            "favoriteColors": [
              "Red",
              "Blue"
            ]
          },
          "email": "<email>",
          "firstName": "John",
          "fullName": "John Doe",
          "id": user_uuid,
          "imageUrl": "http://65.media.tumblr.com/tumblr_l7dbl0MHbU1qz50x3o1_500.png",
          "lastName": "Doe",
          "middleName": "William",
          "mobilePhone": "303-555-1234",
          "preferredLanguages": [
            "en",
            "fr"
          ],
          "timezone": "America/Denver",
          "usernameStatus": "ACTIVE",
          "username": "johnny12333333334"
        }
      }
      
      

      The problem is when I receive the setup password email, I can't set it up because I get missing_redirect_uri error on load page, then as a beginner and professional debugger, I set it on the setup password template (redirect_uri to my redirect_url) and get another error about missing_response_code but I don´t know how to continue, maybe I did a wrong configuration? could you help me? please

      Thank you

      Version: docker 1.28.0

      1 Reply Last reply Reply Quote 0
      • joshuaJ
        joshua
        last edited by

        @bergraan,

        Can you offer a little bit of context around what you are aiming to accomplish?

        Are you using OAuth? To log in or register your users or something else?

        Finally, I am not sure if you are looking for this functionality which was release recently?

        Thanks,
        Josh

        1 Reply Last reply Reply Quote 0
        • B
          bergraan
          last edited by bergraan

          Hi! I just want email link works when I send the set password for control access on register, but when I open the email and click the link I get error on FusionAuth that I shared on my first post 😞
          I don’t know why, maybe I configured something bad or I didn’t. I just up with docker as tutorial said, configured smtp credentials and use python client. User was created and receive the email

          Do you know what happens? Do you need more info?

          Thank you

          1 Reply Last reply Reply Quote 0
          • B
            bergraan
            last edited by

            Add more info:

            I want to create users from my backend with "Create a User and Registration (combined)" and set "sendSetPasswordEmail" to True for user write his own password. I think something like next:

            My backend --> registration on FusionAuth

            FusionAuth --> email to user to configure password

            User --> read email --> click link --> go to FusionAuth request his password --> redirect to app

            I tested now with version 1.28.1 that if I set on "setup password" redirect_uri param it redirects to login.

            User now gets this URL http://localhost:9011/password/change/<code>?client_id=<client_id>&<tenan_id>&redirect_uri=http://localhost:8000/dashboard

            But instead of request him password fusionauth ask him login data, and user hasn't password.

            Is this idea is wrong? i miss understand anything from the documentation?

            Thank you

            1 Reply Last reply Reply Quote 0
            • B
              bergraan
              last edited by

              Hi again, this is me. Maybe i write this for no one, but also I want to document for other beginners or Core developers

              I found a possible solution to the problem. If remove client_id from URL FusionAuth allows me to change the password, I think this is wrong, in the documentation didn't say anything about that, possible bug?

              Example good URL --> http://localhost:9011/password/change/<code>?<tenan_id>
              Example bad URL --> http://localhost:9011/password/change/<code>?client_id=<client_id>&<tenan_id>

              Bad URL is how FusionAuth send to the new users when I set "sendSetPasswordEmail" to true with "setup password" template

              Steps to reproduce:

              1. Create an app
              2. Configure smtp and setup password email
              3. Create API key with user/registration POST permission
              4. Create a new user with sendSetPassword to true. Example payload:
              {
                "registration": {
                  "applicationId": <application-id>,
                  "data": {
                    "displayName": "Johnny",
                    "favoriteSports": [
                      "Football",
                      "Basketball"
                    ],
                  },
                  "id": user_uuid,
                  "preferredLanguages": [
                    "en",
                    "fr"
                  ],
                  "timezone": "America/Chicago",
                  "username": "johnny123",
                  "usernameStatus": "ACTIVE"
                },
                "sendSetPasswordEmail": true,
                "skipVerification": false,
                "user": {
                  "birthDate": "1976-05-30",
                  "data": {
                    "displayName": "Johnny Boy",
                    "favoriteColors": [
                      "Red",
                      "Blue"
                    ]
                  },
                  "email": "<email>",
                  "firstName": "John",
                  "fullName": "John Doe",
                  "id": <user_uuid>,
                  "imageUrl": "http://65.media.tumblr.com/tumblr_l7dbl0MHbU1qz50x3o1_500.png",
                  "lastName": "Doe",
                  "middleName": "William",
                  "mobilePhone": "303-555-1234",
                  "preferredLanguages": [
                    "en",
                    "fr"
                  ],
                  "timezone": "America/Denver",
                  "usernameStatus": "ACTIVE",
                  "username": "johnny123"
                }
              }
              
              1. Go to setup email on the email receiver
              2. Open URL in private tab (Just in case if you are logged)
              3. Get the error missin_redirect_uri

              I hope this information is useful for someone ^^

              1 Reply Last reply Reply Quote 1
              • joshuaJ
                joshua
                last edited by joshua

                Hi @bergraan,

                We can try filing a bug report if you feel something is not working as intended.

                One thing that we can try is to do a process of elimination. To simply test this endpoint, you will want to do three things:

                1. Confirm you get the SMTP test email

                send-test-email-tenant-orginal.png

                You should get an email like this

                test-email-works-orginal.png

                2. Hit the registration endpoint with a rest client like insomnia or postman

                Here is the command that I ran from postman:
                Run in Postman

                Our Endpoint Doc
                https://fusionauth.io/docs/v1/tech/apis/registrations/#request-body-2

                If you run this command, you should get quite a bit back, including a token, regarding your new user. Abbreviated below.

                {
                    "registration": {
                        "applicationId": "85a03867-dccf-4882-adde-1a79aeec50df",
                    },
                    "token": 
                    "user": {
                }
                

                I was able to get a set password email.
                get-email-to-change-orginal.png

                3. Next Steps

                If the above run in postman works for you after putting in the proper headers and UUID's for your application, then we will have to see where else items are failing.

                I hope this helps

                Thanks,
                Josh

                1 Reply Last reply Reply Quote 0
                • joshuaJ
                  joshua
                  last edited by

                  @bergraan,

                  One more note:

                  You will want to ensure you are using the client_id on the URL.

                  To that end, after discussing with the team, I think your URL's may be broken:

                  Example good URL --> http://localhost:9011/password/change/<code>?<tenan_id>
                  Example bad URL --> http://localhost:9011/password/change/<code>?client_id=<client_id>&<tenan_id>
                  

                  should be
                  ⬇ ⬇ ⬇

                  Example good URL --> http://localhost:9011/password/change/<code>?tenantId=<tenant_id>
                  Example bad URL --> http://localhost:9011/password/change/<code>?client_id=<client_id>&tenantId=<tenan_id>
                  

                  I hope this helps!

                  Thanks,
                  Josh

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