Basic oauth to different server?

Hi guys, I’d need to create a oauth function to get jwt token from external endpoint. how to do that?? thanks