it didn't worked
Perhaps double check your code because a single Authentication system works great for me, when the proper authorization is implemented.
And if I teacher can also be a student you may need to look into query Scopes as well.
And I hope I understand the question.
In my case I don't have student and teachers but I have admins and bookkeepers, where some are just admin, but one lady is an admin and a bookkeeper.
Have you viewed Jefferies free videos one on Authentication and he has another on basic authorization.
These are in his free from scratch series.