Skip to content

Auth Server: Microservice for user authentication

Published:

Table of contents

Open Table of contents

Auth Server

Authentication/Authorization microservice written in Go, which provides gRPC endpoints (schemas can be found here) for managing JWT tokens and user’s data. The data is stored in a PostgreSQL and data integrity is maintained through the use of migrations.
Source code can be found on GitHub.

Running Locally

How to Connect From Another Service

cc, err := grpc.DialContext(context.Background(),
	net.JoinHostPort(grpcHost, grpcPort),
	grpc.WithTransportCredentials(insecure.NewCredentials()),
)
authClient := ssov1.NewAuthClient(cc)
resp, err := authClient.Register(ctx, &ssov1.RegisterRequest{
  Email:    email,
  Password: password,
})

Endpoints

gRPC protobuf schemas can be found here. You can import the schema file into Postman and send requests from it.

Auth / Register

Registers a new user.

Auth / Login

Authenticates a user and provides a token.

Auth / IsAdmin

Checks if the user is an admin.

Technologies/Packages Used