Create user from api with autmodule attribute
Hello,
I use Youtrack Helpdesk to provide support for one application.
Users can connect with SSO to youtrack from this application.
I configured an authmodule SAML in Youtrack.
I activated the user creation in the authmodule but it creates user with standard type instead of reporter type.
I use Youtrack api to create user with the correct type reporter and i deactivated the user creation from the authmodule not to duplicate users.
However, the user cannot connect with the SAML authmodule anymore. It says “Authentification fails”. I think the issue is that I did not create the user from the api with the authmodule attribute.
I think the “authModule” attribute is a nested attribute in the "details” attribute but it does not solve it.
I also try to just add the attribute "details" with the type but it created the user in the default authmodule Hub (and not in the authmodule SAML)
→ Can you provide a payload which works to add a user with an authmodule attribute ?
Here is how my payload looks like:
$url = "https://MYWEBSITE/hub/api/rest/users/USERTOUPDATE?fields=id,login,name,userType(id)"
$payload = @{
userType = @{
id = "REPORTER"
}
details = @(
@{
type = "SamlUserDetailsJSON"
}
)
}
Please sign in to leave a comment.
Hi. Unfortunately, it's not possible to create a user with the auth details that will allow them to log in via an external auth provider. It's required that the user logs in with using the corresponding auth module first. It's also not possible to automatically create reporter-type users when they first log in using an auth module (we have a feature request about it: HUB-11642).
A workaround here can be to change the user type of these users to reporters after they are created as standard users.
Hi,
I finally managed to create the user by api with the authModule to the external auth provider.
I changed the payload as the following:
$payload = @{
login = "USERLOGIN"
userType = @{
id = "REPORTER"
}
details = @(
@{
type = "SamlUserDetailsJSON"
authModule = @{
type = "AUTHMODULEVALUE"
id = “AUTHMODULEVALUEID”
}
nameId = "USERNAMEID"
}
)
}
Now the question is: it supported by Youtrack?
I am just using Youtrack Hub Rest Api. As you currently have a feature request, in case you change the Api, will Youtrack provide support to adapt to it ?
I'm afraid it is not supported or expected to work this way. When a user first logs in via an external IdP, their external ID is saved in the database. There is no field that one can provide this value in via Hub REST API.