diff --git a/handler/handler.go b/handler/handler.go
index d3384217f4c1d60ada9963888ce870694648b557..7bb3e9ec0a825ccf64fba71ce65e6d551b90d339 100644
--- a/handler/handler.go
+++ b/handler/handler.go
@@ -27,7 +27,6 @@ import (
 	"code.vereign.com/code/viam-apis/versions"
 	"github.com/golang/protobuf/proto"
 
-	"code.vereign.com/code/key-storage-agent/config"
 	keyutils "code.vereign.com/code/key-storage-agent/utils"
 	"code.vereign.com/code/viam-apis/authentication"
 	"code.vereign.com/code/viam-apis/key-storage-agent/api"
@@ -229,15 +228,12 @@ func (s *KeyStorageServerImpl) ReserveKeyUUID(ctx context.Context, in *api.Reser
 }
 
 func (s *KeyStorageServerImpl) GetKeyId(ctx context.Context, in *api.GetKeyIdByKeyRequest) (*api.GetKeyIdByKeyResponse, error) {
-	viamAuth := &authentication.Authentication{
-		Uuid:    config.SystemAuth.Uuid,
-		Session: config.SystemAuth.Session,
-	}
-
-	entitiesMagamentClient := keyutils.CreateEntitiesManagementClient(viamAuth)
+	auth := s.CreateAuthentication(ctx)
+	//in.PublicKey
+	entitiesMagamentClient := keyutils.CreateEntitiesManagementClient(auth)
 	defer entitiesMagamentClient.CloseClient()
 
-	dataStorageClient := keyutils.CreateDataStorageClient(viamAuth)
+	dataStorageClient := keyutils.CreateDataStorageClient(auth)
 	defer dataStorageClient.CloseClient()
 
 	keyIdResponse := &api.GetKeyIdByKeyResponse{}