Problem after assigning the default role within rules with the login after

Hi everyone

I have the problem that after assigning a default role within rules after the first login, the user doesn’t get logged in right away (the page goes blank and i need to close the browser and log in again to make it work). Several people had this problem before and i found this solution in a post:
renewToken() {
this.auth0Client$.subscribe((client: Auth0Client) => {
client.getTokenSilently({ audience: config.audience, scope: config.domain, ignoreCache: true });
});
}
But i don’t get it where to apply this? Or is there a solution where i can apply this directly in the rule where i assigned the default role?

Thanks for your help.

I tried it with another solution i found in a post and created this rule:

function (user, context, callback) {
  
  var count = context.stats && context.stats.loginsCount ? context.stats.loginsCount : 0;
  if (count > 1) {
    return callback(null, user, context);
  }
  
  var ManagementClient = require('auth0@2.17.0').ManagementClient;
  var management = new ManagementClient({
    token: auth0.accessToken,
    domain: auth0.domain
   
  });

  management.assignRolestoUser(
    { id : user.user_id}, 
    { "roles" :["rol_aDaX1wUBincYGcBE"]},  // sample role ID of "Standard API Enduser"
    function (err) {
      if (err) {
        console.log('Error assigning role: ' + err);
      }    
      callback(null, user, context);
  });
  let assignedRoles = (context.authorization || {}).roles;
  assignedRoles.push('rol_aDaX1wUBincYGcBE');
}

The assigning of the role seems to be working and the website gets loaded (so i have no more blank sceen after login) but the website doesn’t get fully loaded, like it shows the layout of the page but no content. Can any body help me with that? Do i need to add an extra step?
Thanks everyone for helping me!