An open API service indexing awesome lists of open source software.

https://github.com/fusionauth/fusionauth-example-go-jwt-microservices

Example of a golang API gateway with authorization using JWT
https://github.com/fusionauth/fusionauth-example-go-jwt-microservices

Last synced: about 1 year ago
JSON representation

Example of a golang API gateway with authorization using JWT

Awesome Lists containing this project

README

          

# FusionAuth golang microservices example

This code is an example of protecting golang microservices with JSON web tokens.

Read the blog post here: https://fusionauth.io/blog/2021/02/18/securing-golang-microservice/

## To run

This assumes you already have go 1.15.8 installed and have cloned this repo.

In one terminal:
* cd jwt_client
* go get
* go run main.go

In another terminal:
* cd api_gateway
* go get
* go run main.go

In yet another terminal:

* curl http://localhost:8080 # to get the JWT
* curl http://localhost:9001 --header 'Token: [jwt value]' # to get the secret microservice response

Original code by @krissnawat