feat: 授权请求头和查询参数支持accessToken接收
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user