Golang SDK Quick Start Example: dependencies issue

Hey everyone!
The second day I try to get this article working

The issue I face here is that once I try the code given in the example I see the following message:

go: finding module for package github.com/auth0/go-jwt-middleware/validate/jwt-go
github.com/{MY_MODULE_PATH}/apiserver imports
	github.com/auth0/go-jwt-middleware/validate/jwt-go: module github.com/auth0/go-jwt-middleware@latest found (v1.0.1), but does not contain package github.com/auth0/go-jwt-middleware/validate/jwt-go

And because it couldn’t find needed dependencies I can’t even compile the code.

The internet does have such examples but all those ones are built on top of such as old packages for golang, so the official doc says that I don’t need to use them.

Does anyone have a working example of jwt auth mechanism for golang? Or someone knows how to solve that kind of issue?

Hey there!

Can you raise it as a GitHub issue in the quickstart repo so we can get that addressed by the quickstart maintainers? Once you have a link to it you can share it with us here so we can ping them. Thank you!

@dskuratovich I’m also having similar issues with trying to find a valid and working golang repo that uses RS256 as the signing algorithm for auth0 as middleware. Have you figured this out?

If you change the algorithm for your app to use HS256, most jwt middle libraries can support it. IE: chi router: GitHub - go-chi/jwtauth: JWT authentication middleware for Go HTTP services

Nvm. Figured it out. Here’s the most updated golang example with RS256: Auth0 Go API SDK Quickstarts: Authorization
Github: auth0-golang-api-samples/01-Authorization-RS256 at master · auth0-samples/auth0-golang-api-samples · GitHub

FWIW, There are way too many outdated or scattered golang examples for auth in too many different repos. Try to archive the ones that aren’t the most up to date.

1 Like

And more examples here that are listed on the website: Golang Web Code Samples: API Security in Action

Example: role based access control, which uses a totally different middleware than whats stated in the previous post above: api_standard-library_golang_hello-world/main.go at with-go-jwt-middleware-v2 · auth0-developer-hub/api_standard-library_golang_hello-world · GitHub

Different middlewares:

Totally fine, but a bit confusing for a developer who just wants to use something out of the box and then there’s a bunch of different tutorials using different packages.

Perfect! Thanks for sharing it with the rest of community!