Giter VIP home page Giter VIP logo

Comments (6)

mooreds avatar mooreds commented on August 20, 2024

Hi @hantsy . Thanks for using FusionAuth!

The username in the registration is for display purposes only. From the [registrations documentation[(https://fusionauth.io/docs/v1/tech/apis/registrations), registration.username.

The username of the User for this Application. This username cannot be used to login. It is for display purposes only. The user.username field may be used to login.

So this field lets you have users with different display names in different applications (mooreds in a forum, dan.moore in a support ticket system, etc).

Hope that clears this up. I'm going to close out this issue.

from fusionauth-java-client.

hantsy avatar hantsy commented on August 20, 2024

Currently I used username of UserRegistratoin and call the client register method to register a new user. Not for display.

What confused me it the user registration request spec contains this field, and I have set it, but it is not applied when calling register.

from fusionauth-java-client.

hantsy avatar hantsy commented on August 20, 2024

So this field lets you have users with different display names in different applications (mooreds in a forum, dan.moore in a support ticket system, etc).

Currently these fields are part of the request object spec, and they can be set freely, but did not work as expected.

For each endpoints, every field of the request object should be affected if assigning a value.

from fusionauth-java-client.

mooreds avatar mooreds commented on August 20, 2024

For each endpoints, every field of the request object should be affected if assigning a value.

I'm not sure I understand the issue. Can you please share some code snippets?

from fusionauth-java-client.

mooreds avatar mooreds commented on August 20, 2024

I see some code snippets above, but I'm not clear on which username is not stored if you uncomment username in UserRegistration. Is there a value on user.username, user.registration.username, both or none?

from fusionauth-java-client.

mooreds avatar mooreds commented on August 20, 2024

So I just tried to replicate with this code:

package io.fusionauth.example;

import java.util.UUID;
import com.inversoft.error.Errors;
import io.fusionauth.client.FusionAuthClient;
import io.fusionauth.domain.User;
import io.fusionauth.domain.UserRegistration;
import io.fusionauth.domain.api.user.RegistrationRequest;
import io.fusionauth.domain.api.user.RegistrationResponse;
import com.inversoft.rest.ClientResponse;
import java.util.*;

public class RegisterUser {

    public static void main(String[] args) {

        ApplicationProperties.setupProperties();

        // Initiating the client
        FusionAuthClient client = new FusionAuthClient(ApplicationProperties.getApiKey(),
                ApplicationProperties.getFusionAuthURL());

        // Initiating the user and providing registration details
        User javauser = new User();
        javauser.email = "[email protected]";
        javauser.password = "password";
        javauser.lastName = "last";
        javauser.firstName = "first";
        javauser.username = "username3";

        // Initiating user registration and creating request object
        UserRegistration userreg = new UserRegistration();
        userreg.applicationId = UUID.fromString("20ce6dac-b985-4c77-bb59-6369249f884b");
        SortedSet<String> roles = new TreeSet<String>();
        roles.add("ADMIN");
        userreg.roles = roles;
        userreg.username = "regusername3";

        RegistrationRequest request = new RegistrationRequest(javauser, userreg);

        // Using the returned ClientResponse object
        ClientResponse<RegistrationResponse, Errors> response = client.register(null, request);

        if (response.wasSuccessful()) {
            System.out.println("Registration successful");

        } else {
            // Handling errors
            System.out.println(response.errorResponse);
        }
    }

}

And I was able to provide the username on the user object as well as on the registration object.

I'm going to close this since I can't reproduce. Please re-open if you can provide replication steps or if I misunderstand the issue.

from fusionauth-java-client.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.