mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-22 17:31:03 +01:00
15 lines
285 B
Go
15 lines
285 B
Go
package utils
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"strings"
|
|
)
|
|
|
|
func GetAPITokenFromContext(c *gin.Context) string {
|
|
tokenStr := c.GetHeader("Authorization")
|
|
if strings.HasPrefix(tokenStr, "Bearer ") {
|
|
tokenStr = strings.Replace(tokenStr, "Bearer ", "", 1)
|
|
}
|
|
return tokenStr
|
|
}
|