I hope you can help me solve my dilemma. I am building an API which uses a custom JWT token based authentication. To make it simple let's say that the client request a token and said token is associated to an inteal id.
Now, I would like the client to be able to choose to authenticate with an oauth2 provider, which I would ideally link to my inteal id. It is worth noting that the client acts independently of my API, but uses the API for some of its functions.
The first question is: which workflow is the correct one:
Client->oauth2 server->retrieve token->send token to my api or Client->my api acting as a proxy ?
Furthermore, in these cases what data should I keep on my server?
I find plenty of resources on how to setup an oauth2 server, but nothing about allowing my users to login to my api using oauth2 credentials coming form another oauth2 server.
