Restrict authentication only for users with role

Hello I’m trying to restrict the oauth login only to the users that have a role ,

It is working as intented in general, but i identified that on the first login of a user that has an account but does not have the role it is not “denying access”, all subsequent requests get denyed though.

Any advise on what am i doing wrong?

thanks in advance