API supporting multiple authentication providers?
I am currently looking at building an API server that will support multiple authentication providers (Google, GitHub, Keycloak, etc) and I am trying to work out what’s a good way to go about it. Two approaches I am considering now: all endpoints can accept the auth tokens from the supported providers have a token exchange endpoint that would take an token from an auth provider and provide an API specific one, along with an expiry time, which would then require a new token exchange What are your thoughts? Is there another approach to this?

I am currently looking at building an API server that will support multiple authentication providers (Google, GitHub, Keycloak, etc) and I am trying to work out what’s a good way to go about it. Two approaches I am considering now:
- all endpoints can accept the auth tokens from the supported providers
- have a token exchange endpoint that would take an token from an auth provider and provide an API specific one, along with an expiry time, which would then require a new token exchange
What are your thoughts? Is there another approach to this?