User ID Set Group

hello I would like to know if it is possible to set a group to a user who never entered the server but only through his user id I am waiting for your answers thank you

A user who never entered your server has no ID or any other database entry yet.
So technically this will not work.

What you could do is to create a token / privilege key for that user and when he used that he will be in the group.