Fix interactive SSO login when creating account from a device (#575)

This commit is contained in:
Misha Bragin 2022-11-22 12:37:36 +01:00 committed by GitHub
parent 8b0a1bbae0
commit 53c532bbb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -202,6 +202,11 @@ func (s *GRPCServer) registerPeer(peerKey wgtypes.Key, req *proto.LoginRequest)
}
claims := jwtclaims.ExtractClaimsWithToken(token, s.config.HttpConfig.AuthAudience)
userID = claims.UserId
// we need to call this method because if user is new, we will automatically add it to existing or create a new account
_, _, err = s.accountManager.GetAccountFromToken(claims)
if err != nil {
return nil, status.Errorf(codes.Internal, "unable to fetch account with claims, err: %v", err)
}
} else {
log.Debugln("using setup key to register peer")
reqSetupKey = req.GetSetupKey()