Skip to content

Empty claims when extracting claims inside Authenticator. #206

@itsmeabhilashgk

Description

@itsmeabhilashgk

I am trying to extract claims inside the Authenticator, to perform certain operations right after successful authentication - Login.

However I am getting empty claims everytime I extract them using the Extractclaims() method.

However I get the proper claim values in the Authorizatior.

Authenticator: func(c *gin.Context) (interface{}, error) {
        claims := jwt.ExtractClaims(c)
	fmt.Println(claims["id"].(string))
}

I get nil for claim value inside authenticator.

Authorizator: func(data interface{}, c *gin.Context) bool {
	claims := jwt.ExtractClaims(c)
	fmt.Println(claims["id"].(string))
		},

I am getting the Id when using with Authorizatior.

Also the context body is right.

What am I missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions