You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
connect-go v2 is out (v2.0.2), and authn-go still depends on connectrpc.com/connect v1. On a v2 server, two parts of the package break:
Middleware writes errors with v1's connect.NewErrorWriter. It doesn't recognise a v2 *connect.Error returned by an AuthFunc, so an expired or invalid token reaches the client as unknown (HTTP 500) instead of unauthenticated (401).
Errorf returns a v1 *connect.Error. A v2 handler that returns it sends unknown with no message.
The rest (AuthFunc, BearerToken, SetInfo / GetInfo) doesn't touch connect-go and works unchanged.
We migrated a service to v2 and worked around this with a small copy of Middleware and Errorf built on connecthttp.NewErrorWriter and v2's connect.Errorf.
Is v2 support planned? If not, would you accept a PR? One option is a connectrpc.com/authn/v2 module that depends on connect-go v2. It would keep the same API, with Middleware taking connecthttp options, while v1 stays as it is. I'm happy to follow a different layout if you'd prefer one.
Hi @jferrl, thanks for creating the issue. We need a better story for the authn-go v2 behaviour. We don't have a v1 release of this module so a /v2/ module would skip a v1 release. See related issue connectrpc/otelconnect-go#227.
I looked at moving to a pure v2 implementation in the branch connect-v2. In connect-go v1 it was a security issue to run authentication as an interceptor. See the v2 interceptor documentation for the background. So the issue with moving this to v2 is that it removes lots of the benefit of this module as it becomes trivial to implement in an interceptor. The authn-go helpers are still helpful though.
Users have written custom interceptors to replace the authn-go module: https://go.dev/play/p/ZGIWI1AaisT
We could provide helpers for users to implement interceptors and an interceptor like that.
So I propose we add some v2 helpers to authn-go and make a new release. Happy to accept a PR, but I can look at adding this now too.
Hi @jferrl, thanks for creating the issue. We need a better story for the authn-go v2 behaviour. We don't have a v1 release of this module so a /v2/ module would skip a v1 release. See related issue connectrpc/otelconnect-go#227.
Thanks, that direction LGTM. We’ll keep our small compatibility middleware until the v2 helpers are available. Happy to test them against our migration.
Activity
emcfarlane commentedon Nov 11, 2026
Hi @jferrl, thanks for creating the issue. We need a better story for the authn-go v2 behaviour. We don't have a v1 release of this module so a
/v2/module would skip a v1 release. See related issue connectrpc/otelconnect-go#227.I looked at moving to a pure v2 implementation in the branch connect-v2. In connect-go v1 it was a security issue to run authentication as an interceptor. See the v2 interceptor documentation for the background. So the issue with moving this to v2 is that it removes lots of the benefit of this module as it becomes trivial to implement in an interceptor. The authn-go helpers are still helpful though.
Users have written custom interceptors to replace the authn-go module: https://go.dev/play/p/ZGIWI1AaisT
We could provide helpers for users to implement interceptors and an interceptor like that.
So I propose we add some v2 helpers to authn-go and make a new release. Happy to accept a PR, but I can look at adding this now too.
jferrl commentedon Nov 11, 2026
Thanks, that direction LGTM. We’ll keep our small compatibility middleware until the v2 helpers are available. Happy to test them against our migration.
emcfarlane commentedon Nov 12, 2026
@jferrl added the API in #32, please let me know if you test it and its suitable for your use case?
jferrl commentedon Nov 12, 2026
Thanks! let me take a look! :)