Skip to content

register a user to an application #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
smilad opened this issue Oct 17, 2023 · 1 comment
Open

register a user to an application #78

smilad opened this issue Oct 17, 2023 · 1 comment

Comments

@smilad
Copy link

smilad commented Oct 17, 2023

when i want to register user to and application I have a error and give me that user exist:
package main

import (
"github.com/FusionAuth/go-client/pkg/fusionauth"
"log"
"net/http"
"net/url"
)

func main() {
var HttpClient = &http.Client{}

u, _ := url.Parse("http://192.168.13.32:9011")
f := fusionauth.NewClient(HttpClient, u, "hBUKq3x_hUFXqA6GSXhdWWTRknTq7uzTNc_SzCmhpgDgm0UpNI-Wm56C")

r, e1, e2 := f.Register("e2337690-4c91-4573-bbed-88695701612f", fusionauth.RegistrationRequest{
	Registration: fusionauth.UserRegistration{
		ApplicationId: "dee6cf94-0bdc-4050-bca8-04ac1920ee9b",
		Username:      "dtd",
		Roles:         []string{"10"},
	},
})

log.Println("response", r)
log.Println("des err : ", e1)
log.Println("err", e2)

}

and my error is:

user.email: You must specify either the [user.email] or [user.username] property. If you are emailing the user you must specify the [user.email]. user.password: You must specify the [user.password] property. user.username: You must specify either the [user.email] or [user.username] property. If you are emailing the user you must specify the [user.email]. userId: A User with Id [e2337690-4c91-4573-bbed-88695701612f] already exists.

@john-peterson-g17
Copy link

I have this same error.

faRegistrationReq := fusionauth.RegistrationRequest{
	SkipRegistrationVerification: true,
	SkipVerification:             true,
	Registration: fusionauth.UserRegistration{
		Id:            registration.ID,
		ApplicationId: registration.ApplicationID,
		Roles:         roles,
	},
}

resp, faErrs, err := s.faClient.Register(registration.UserID, faRegistrationReq)

Serialization of the RegistrationRequest struct shows:

{
  "eventInfo": {
    "location": {}
  },
  "disableDomainBlock": false,
  "generateAuthenticationToken": false,
  "registration": {
    "applicationId": "15fd0844-6668-425f-b9f9-0f781df2edfd",
    "id": "da07f7b5-f46a-4b9f-bd84-2298083bdee0",
    "verified": false
  },
  "sendSetPasswordEmail": false,
  "skipRegistrationVerification": true,
  "skipVerification": true,
  "user": {
    "passwordChangeRequired": false,
    "verified": false,
    "active": false,
    "twoFactor": {}
  }
}

This is on version 1.57.1 of the sdk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants