MCPcopy
hub / github.com/appleboy/gin-jwt / getRefreshTokenFromLogin

Function getRefreshTokenFromLogin

auth_jwt_test.go:196–212  ·  view source on GitHub ↗

getRefreshTokenFromLogin performs a login and returns the refresh token from the response

(handler *gin.Engine)

Source from the content-addressed store, hash-verified

194
195// getRefreshTokenFromLogin performs a login and returns the refresh token from the response
196func getRefreshTokenFromLogin(handler *gin.Engine) string {
197 r := gofight.New()
198 var refreshToken string
199
200 r.POST("/login").
201 SetJSON(gofight.D{
202 "username": testAdmin,
203 "password": testAdmin,
204 }).
205 Run(handler, func(r gofight.HTTPResponse, rq gofight.HTTPRequest) {
206 if r.Code == http.StatusOK {
207 refreshToken = gjson.Get(r.Body.String(), "refresh_token").String()
208 }
209 })
210
211 return refreshToken
212}
213
214func ginHandler(auth *GinJWTMiddleware) *gin.Engine {
215 gin.SetMode(gin.TestMode)

Callers 4

TestRefreshHandlerRS256Function · 0.85
TestRefreshHandlerFunction · 0.85
TestValidRefreshTokenFunction · 0.85

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…