How can I get user badges?

I am wondering how I would be able to fetch the image urls (or if there is a better way) for the badges so I can add them in front of the users name for my chat widget.

The URLs can be obtained from the API:

https://dev.twitch.tv/docs/api/reference/#get-channel-chat-badges

https://dev.twitch.tv/docs/api/reference/#get-global-chat-badges