From 1ca1fd411a3e7cd5ab50e6704961f0b915a7ea87 Mon Sep 17 00:00:00 2001 From: Ben Toogood Date: Wed, 13 May 2020 18:17:04 +0100 Subject: [PATCH] Auth: Fix recursive bug --- util/wrapper/wrapper.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/util/wrapper/wrapper.go b/util/wrapper/wrapper.go index 8b501b12..6de4a663 100644 --- a/util/wrapper/wrapper.go +++ b/util/wrapper/wrapper.go @@ -171,6 +171,12 @@ func (a *authWrapper) Call(ctx context.Context, req client.Request, rsp interfac return callWithToken(aaOpts.Token.AccessToken) } + // check to ensure we're not calling auth, since this will result in + // an endless loop + if req.Service() == "go.micro.auth" { + return a.Client.Call(ctx, req, rsp, opts...) + } + // if we have a refresh token we can use this to generate another access token if aaOpts.Token != nil { tok, err := aa.Token(auth.WithToken(aaOpts.Token.RefreshToken))