Go-auth - An authorization project using mongoDB, JWT and Go


Ssibrahimbas Go-Auth

An authorization project using mongoDB, JWT and Go.

API

Types
User
HTTP REQUEST Name
POST Register
POST Login
GET Verify Login



UserType

the user's fields and their types.

Field Json Bson GoLang Type
name name name Name string
gender gender gender Gender string
age age age Age int
email email email Email string
password password password Password string

In Golang, starting fields with a capital letter makes them public. That's why the first letters of all our fields are capitalized. If we didn't want them to be accessible from outside (private), we would write them in lowercase.



register

If the user registers and the transaction is successful, a token is returned is the header of the Response.

Params Type
name string
gender string
age int
email string
password string

Example Request

POST http://localhost:8080/api/register
Content-Type: application/json

{
    "name": "Sami Salih İbrahimbaş",
    "gender": "Man",
    "age": 20,
    "email": "[email protected]",
    "password": "secretPassword"
}

Returns

{
    "success": true,
    "message": "Login Successful."
}



login

The user enters the email and password fields. If there is a registration and the passwords match, the login is provided. In the header of Response, the token is passed as in the registration process.

Params Type
email string
password string

Example Request

POST http://localhost:8080/api/login
Content-Type: application/json

{
    "email": "[email protected]",
    "password": "secretPassword"
}

Returns

{
    "success": true,
    "message": "Login Successful."
}



verifyLogin

Token is sent in Request's Header. If the token exists and is available, the entry is validated. Otherwise, an error is received.

Example Request

GET http://localhost:8080/api/verifyLogin
Authorization: Bearer dssdcvkşldscasşasdşlsadlşef

Returns

{
  "success": false,
  "message": "Not Authorized"
}



Owner
Sami Salih İbrahimbaş
Full Stack Developer
Sami Salih İbrahimbaş
Similar Resources

backend implementation demonstration in go with JWT, MongoDB and etc.

backend implementation demonstration in go with JWT, MongoDB and etc.

Nov 19, 2022

Golang with JWT, Go Gin and MongoDB

User authentication in Golang with JWT, Go Gin and MongoDB Golang backend application that uses JWT tokens for users Locally Up Setup your .env file,

Sep 16, 2022

JWT wrapper library which makes it simple to use ECDSA based JWT signing

JWT JWT wrapper library which makes it simple to user ECDSA based JWT signing. Usage package main import ( "context" "github.com/infiniteloopcloud

Feb 10, 2022

Account-jwt-go - Simple JWT api with go, gorm, gin

Account-jwt-go - Simple JWT api with go, gorm, gin

Account JWT on Go Go, gorm, Gin web framework 를 활용하여 만든 간단한 JWT API 입니다. Dajngo의

Apr 14, 2022

Krakend-jwt-header-rewriter - Kraken Plugin - JWT Header Rewriter

Kraken Plugin - JWT Header Rewriter 1 Plugin Configuration Name Desciption Defau

Feb 15, 2022

telegram authorization in telegram without using a widget

TGAH - telegram Authorization Example of authorization in telegram without using a widget Installation go get -d github.com/tioffs/tgah@master Setti

Jun 6, 2022

A simple user identify template with jwt token and gin, toy project

Simple Docs Register url : /api/auth/register param type value name string username password string password mailbox string mailbox response: { "sta

Dec 31, 2021

Mini-framework for multiple authentication and authorization schemes

Mini-framework for multiple authentication and authorization schemes

Go authorization pattern This repository demonstrates an authorization pattern that allows multiple schemes. Demo To start the demo run the following

Dec 30, 2021

Authelia: an open-source authentication and authorization server providing two-factor authentication

Authelia: an open-source authentication and authorization server providing two-factor authentication

Authelia is an open-source authentication and authorization server providing two

Jan 5, 2022
Blog-mongodb - this repository for educational purpose, learn how to use mongodb and use mongodb with go

ENDPOINT ENDPOINT METHOD ACCESS /register POST all /login POST all /articles GET all /articles POST all /articles/{articleId} GET all /articles/{artic

Jan 4, 2022
Backend Development Rest Api Project for book management system. Used Features like redis, jwt token,validation and authorization.

Golang-restapi-project Simple Rest Api Project with Authentication, Autherization,Validation and Connection with redis File Structure ├── cache │ ├──

May 25, 2022
Authorization and authentication. Learning go by writing a simple authentication and authorization service.

Authorization and authentication. Learning go by writing a simple authentication and authorization service.

Aug 5, 2022
A demo of authentication and authorization using jwt
A demo of authentication and authorization using jwt

Nogopy Hi, this a demo of how to use jwt for authentication in microservices Keep in mind that this is a demo of how to authenticate using jwt, we don

Nov 1, 2021
Go-gin-jwt - Secure web api using jwt token and caching mechanism

Project Description This project demonstrate how to create api and secure it wit

Jan 27, 2022
The forward-auth server for API keys authorization
The forward-auth server for API keys authorization

Token-login The authorization system based on tokens. Token-login is a server that functions as a forward auth server and provides an authorization fl

May 6, 2023
vault-plugin-auth-usertotp is an auth method plugin for HashiCorp Vault

vault-plugin-auth-usertotp is an auth method plugin for HashiCorp Vault. Create user accounts, add TOTP tokens (user supplied pin + totp), and have peace of mind using 2FA.

Jul 5, 2021
vault-plugin-auth-usertotp is an auth method plugin for HashiCorp Vault.

vault-plugin-auth-usertotp is an auth method plugin for HashiCorp Vault. Create user accounts, add TOTP tokens (user supplied pin + totp), and have peace of mind using 2FA.

Jul 30, 2021
Gets Firebase auth tokens (for development purposes only)Gets Firebase auth tokens

Firebase Token Gets Firebase auth tokens (for development purposes only) Getting started Create Firebase project Setup Firebase authentication Setup G

Nov 17, 2021
JWT Auth in Golang

Credits This package used github.com/dgrijalva/jwt-go underhood and it heavily based on this post: http://www.inanzzz.com/index.php/post/kdl9/creating

Dec 12, 2021