Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/moemoe89/simple-implementation-jwt-golang
🔐 Simple Implementation JWT using Golang (Iris Framework), Docker, Travis CI and Coveralls
https://github.com/moemoe89/simple-implementation-jwt-golang
docker go golang iris jwt travis-ci
Last synced: 1 day ago
JSON representation
🔐 Simple Implementation JWT using Golang (Iris Framework), Docker, Travis CI and Coveralls
- Host: GitHub
- URL: https://github.com/moemoe89/simple-implementation-jwt-golang
- Owner: moemoe89
- License: mit
- Created: 2016-11-18T03:42:36.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-02-28T15:47:35.000Z (almost 5 years ago)
- Last Synced: 2024-11-13T15:56:06.751Z (2 months ago)
- Topics: docker, go, golang, iris, jwt, travis-ci
- Language: Go
- Homepage:
- Size: 7.99 MB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/moemoe89/simple-implementation-jwt-golang.svg?branch=master)](https://travis-ci.org/moemoe89/simple-implementation-jwt-golang)
[![Coverage Status](https://coveralls.io/repos/github/moemoe89/simple-implementation-jwt-golang/badge.svg?branch=master)](https://coveralls.io/github/moemoe89/simple-implementation-jwt-golang?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/moemoe89/simple-implementation-jwt-golang)](https://goreportcard.com/report/github.com/moemoe89/simple-implementation-jwt-golang)# Simple-Implementation-JWT-Golang
![demo](simple-implementation-jwt-golang-demo.gif)
Simple Implementation JWT Using Golang (Iris Framework) with Go Mod as Programming Language
This repository created to show the example for using [JWT](https://jwt.io/) with this library [dgrijalva/jwt-go](https://github.com/dgrijalva/jwt-go)
## Directory structure
Your project directory structure should look like this
```
+ your_gopath/
|
+--+ src/github.com/moemoe89
| |
| +--+ simple-implementation-jwt-golang/
| |
| +--+ main.go
| + api/
| + routers/
| + ... any other source code
|
+--+ bin/
| |
| +-- ... executable file
|
+--+ pkg/
|
+-- ... all dependency_library required```
## Requirements
Go >= 1.11
## Setup and Build
* Setup Golang
* Under `$GOPATH`, do the following command :
```
$ mkdir -p src/github.com/moemoe89
$ cd src/github.com/moemoe89
$ git clone
$ mv simple-implementation-jwt-golang
```# Demo
Use this host [https://simple-jwt-golang.herokuapp.com/](https://simple-jwt-golang.herokuapp.com/)# Running & Using Application
Make sure you already have [POSTMAN](https://www.getpostman.com/)> Running the application using `go run main.go`
> Open your POSTMAN.
> Fill the url with localhost:8789/generate and choose GET method
> You will get the response below :
{
"message": "Successfully generated token.",
"success": true,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHBpcmVkX3RpbWUiOjE0Nzk0NDExNTEsInRoaXJkX3BhcnR5IjoibW9tbyJ9.P5sZwzCJD1DYptpuCp4hIyY5pGGnOB7m6ZHHi_mBEi4"
}
> For checking the token, fill the url with localhost:3000/parse and choose GET method. Fill the Header variable with Authorization and the value with token that you've get. You will get the response below :
{
"data": {
"third_party": "momo",
"expired_time": 1479441229
},
"message": "Successfully parsed token.",
"success": true
}# Running with Docker
```
$ docker build -t simple-implementation-jwt-golang .
$ docker run -d -p 8789:8789 --name simple-jwt-go simple-implementation-jwt-golang
```
How to stop the docker
```
$ docker ps
```
Copy the CONTAINER ID
```$xslt
$ docker stop {$CONTAINER_ID}
```