Quantcast
Channel: JWT.io - Auth0 Community
Viewing all articles
Browse latest Browse all 151

Failed to auth access toekn with go

$
0
0

Ready to post? :mag: First, try searching for your answer.
Error: error getting the keys from the key func: could not get well known endpoints from url https://dev-7pdhfkst4gp1rybs.us.auth0.com/.well-known/openid-configuration: Get "https://dev-7pdhfkst4gp1rybs.us.auth0.com/.well-known/openid-configuration\“: http: server gave HTTP response to HTTPS client”

code:

func NewAuthingManager(ctx context.Context, opts *options.Options) (*AuthingManager, error) {
	issuerURL, err := url.Parse("https://dev-7pdhfkst4gp1rybs.us.auth0.com/")
	if err != nil {
		return nil, err
	}

	provider := jwks.NewCachingProvider(issuerURL, 5*time.Minute)
	jwtValidator, err := validator.New(
		provider.KeyFunc,
		validator.RS256,
		issuerURL.String(),
		[]string{os.Getenv("https://dev-7pdhfkst4gp1rybs.us.auth0.com/api/v2/")},
		validator.WithCustomClaims(
			func() validator.CustomClaims {
				return &CustomClaims{}
			},
		),
		validator.WithAllowedClockSkew(time.Minute),
	)
	if err != nil {
		return nil, err
	}

	databaseController, err := database.NewDatabaseController(
		opts.DBUser, opts.DBPassword, opts.DBHost, opts.DBPort)
	if err != nil {
		return nil, err
	}
	return &AuthingManager{
		userIDToAPIKeyMap:    map[string]string{},
		apiKeyMapToUserIDMap: map[string]string{},
		auth0Client:          jwtValidator,
		databaseController:   databaseController,
	}, nil
}
....
        ret, err := a.auth0Client.ValidateToken(context.Background(), token)
	if err != nil {
		return false, "", err
	}

3 posts - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 151

Trending Articles