mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-21 00:29:03 +01:00
feat(auth): add GET endpoint for logout and update documentation
This commit is contained in:
@@ -56,6 +56,7 @@ func NewHandler() *gin.Engine {
|
||||
v1Auth.GET("/callback", authApi.Callback)
|
||||
v1Auth.POST("/callback", authApi.Callback)
|
||||
v1Auth.POST("/logout", authApi.Logout)
|
||||
v1Auth.GET("/logout", authApi.Logout)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
// @Produce plain
|
||||
// @Success 302 {string} string "Redirects to home page"
|
||||
// @Router /auth/logout [post]
|
||||
// @Router /auth/logout [get]
|
||||
func Logout(c *gin.Context) {
|
||||
auth.GetDefaultAuth().LogoutHandler(c.Writer, c.Request)
|
||||
}
|
||||
|
||||
@@ -285,6 +285,26 @@
|
||||
}
|
||||
},
|
||||
"/auth/logout": {
|
||||
"get": {
|
||||
"description": "Logs out the user by invalidating the token",
|
||||
"produces": [
|
||||
"text/plain"
|
||||
],
|
||||
"tags": [
|
||||
"auth"
|
||||
],
|
||||
"summary": "Logout",
|
||||
"responses": {
|
||||
"302": {
|
||||
"description": "Redirects to home page",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-id": "logout",
|
||||
"operationId": "logout"
|
||||
},
|
||||
"post": {
|
||||
"description": "Logs out the user by invalidating the token",
|
||||
"produces": [
|
||||
|
||||
@@ -1613,6 +1613,19 @@ paths:
|
||||
- auth
|
||||
x-id: login
|
||||
/auth/logout:
|
||||
get:
|
||||
description: Logs out the user by invalidating the token
|
||||
produces:
|
||||
- text/plain
|
||||
responses:
|
||||
"302":
|
||||
description: Redirects to home page
|
||||
schema:
|
||||
type: string
|
||||
summary: Logout
|
||||
tags:
|
||||
- auth
|
||||
x-id: logout
|
||||
post:
|
||||
description: Logs out the user by invalidating the token
|
||||
produces:
|
||||
|
||||
Reference in New Issue
Block a user