Nir Adler
Piece by Piece

Follow

Piece by Piece

Follow
Serverless Authentication with Golang

Photo by Dan Nelson on Unsplash

Serverless Authentication with Golang

Nir Adler's photo
Nir Adler
ยทJul 4, 2022
Play this article

Almost every project needs authentication to serve secure user content.

For most of my side projects, I prefer to pay per use for cost optimization.

continuing my experiment with Golang, I created Golang service that's going to run inside AWS Lambda function and store the data in Dynmodb database, I'm using serverless AWS services to fulfil my requirement of cost optimize service.

GitHub repo

Features

  • Email/password login

  • Forgot password

  • Provider login using google/github and more

  • Multi tenant(orgs)

  • Store user data on signup

  • Basic roles

  • Invite users

  • Emails template

  • JWT

Supported routes:

methodroutepayloadRolepublicdescription
POST/v1/auth/loginemail, passwordtrueLogin
POST/v1/auth/login/emailemailtruePasswordless Login
POST/v1/auth/signupemail, password, datatrueSignup
GET/v1/auth/validatetrueValidateToken
POST/v1/auth/renewfalseGet new Token
GET/v1/auth/provider/:providertrueLogin with provider
GET/v1/auth/provider/:provider/callbacktrueValidate provider login
GET/v1/users/metrueHealth check
PUT/v1/users/medatafalseUpdate user data
PUT/v1/users/me/passwordpassword,repeated passwordfalseUpdate user password
POST/v1/orgsnamefalseCreate Org
POST/v1/orgs/:orgId/inviteemail, roleadminfalseInvite user to me org
GET/v1/orgs/:orgId/usersadminfalseGet org users
ย 
Share this