1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-24 10:07:04 +02:00

Merge pull request #1632 from micro/fix-auth-bug

Auth: Fix recursive bug
This commit is contained in:
ben-toogood 2020-05-13 18:18:39 +01:00 committed by GitHub
commit 09d1450d7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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))