Generate JWT for user

Hello,
I am using Strapi v4 and I have to implement local auth & OAuth, so my idea is to have endpoint, that will get token from oauth and then fetch user data and then use the obtained email to register user (if not registered yet) with random long password that will be never used and therefore I would like to generate JWT token and return it to frontend app so it was very similiar to local auth provider. Is that possible? Or there is better way to do that?

I have also experimented with custom provider Roles & Permissions - Strapi Developer Docs , but without any success, idk if the names are outdated, but the provider does not do anything with database plugin_users-permissions_grant , so It wont show in strapi admin