Spawner self.user dont have updated information

We are using a custom spawner where according to the groups mapped to a user different configurations will be shown as options. But we are noticing that self.user.groups and self.user.admin is not updated as I can see by hitting the API for that particular user.

Is there a way to refresh the state of the user object available inside the spawner?

In handler/base.py, I can see we are refreshing the state using the below code

auth_user = await self.refresh_auth(user, force=True)

Can we do something similar inside the spawner too?

Hi! I’m not sure what you mean. Are you able to share the code for your custom spawner? If not can you share a minimal example that demonstrates your problem? Thanks!

Here is the sample spawner code where I am facing the issue

class EcsTaskSpawner(Spawner):
    """
    ECS Task Spawner
    """

    form_template = """
        {hint_para}
        </select>
        <label for="notebook_type">Select notebook type:</label>
        <select class="form-control" name="notebook_type" required autofocus>
        {notebook_types}
        </select>
        """

    input_template = """
        <option value="{key}" {first}>{display}</option>
        """
    
    def _options_form_default(self):
        # Here I am getting old groups list
        user_groups = [group.name for group in self.user.groups]
        # Here I am getting old boolean value
        is_admin = self.user.admin
        return "string_form_html"

@manics Were you able to check this?