feat: 授权请求头和查询参数支持accessToken接收

This commit is contained in:
TsMask
2024-03-18 11:11:41 +08:00
parent b8244ed242
commit 70388e5fe6
4 changed files with 17 additions and 3 deletions

View File

@@ -66,6 +66,15 @@ func IPAddrLocation(c *gin.Context) (string, string) {
// Authorization 解析请求头
func Authorization(c *gin.Context) string {
// Query请求查询
if authQuery, ok := c.GetQuery(token.ACCESS_TOKEN); ok && authQuery != "" {
return authQuery
}
// Header请求头
if authHeader := c.GetHeader(token.ACCESS_TOKEN); authHeader != "" {
return authHeader
}
// Query请求查询
if authQuery, ok := c.GetQuery(token.RESPONSE_FIELD); ok && authQuery != "" {
return authQuery