1
0
mirror of https://github.com/chai2010/advanced-go-programming-book.git synced 2025-05-23 20:02:22 +00:00

Merge pull request #503 from yangsijie666/issue#500-fix

fix issue#500
This commit is contained in:
chai2010 2020-04-10 16:28:34 +08:00 committed by GitHub
commit 6c4d0cd644
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -269,10 +269,10 @@ func (a *Authentication) Auth(ctx context.Context) error {
var appid string
var appkey string
if val, ok := md["login"]; ok { appid = val[0] }
if val, ok := md["user"]; ok { appid = val[0] }
if val, ok := md["password"]; ok { appkey = val[0] }
if appid != a.Login || appkey != a.Password {
if appid != a.User || appkey != a.Password {
return grpc.Errorf(codes.Unauthenticated, "invalid token")
}