Git Product home page Git Product logo

gf-jwt's Introduction

gf-jwt

GF jwt plugin

This plugin is forked https://github.com/appleboy/gin-jwt plugin, modified to https://github.com/gogf/gf plugin.

英文 中文

Use

Download and install

$ go get github.com/gogf/gf-jwt

Import

import "github.com/gogf/gf-jwt"

Example

Check demo example/auth/auth.go and use ExtractClaims to customize user data.

Demo

Run example/server/server.go on the 8000 port.

$ go run example/server/server.go

api screenshot

Test the effect on the command line via httpie.

Login interface:

$ http -v --form POST localhost:8000/login username=admin password=admin

Command line output

api screenshot

Refresh token interface:

$ http -v -f GET localhost:8000/user/refresh_token "Authorization:Bearer xxxxxxxxx" "Content-Type: application/json"

Command line output

api screenshot

hello interface

We test the return of the hello interface with the username admin and password admin

$ http -f GET localhost:8000/user/hello "Authorization:Bearer xxxxxxxxx" "Content-Type: application/json"

Command line output

api screenshot

User Authentication Interface

We use an unauthorized token to test the return of the hello interface.

$ http -f GET localhost:8000/user/hello "Authorization:Bearer xxxxxxxxx" "Content-Type: application/json"

Command line output

api screenshot

Thanks again https://github.com/appleboy/gin-jwt

gf-jwt's People

Contributors

zhaopengme avatar gqcn avatar mingzaily avatar yss930819 avatar stardemo avatar ywtywt337 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.