Help Center> ServiceStage> FAQ> Java SDK FAQs> Message "Invalid request, header is invalid, ak sk or project is empty." Is Displayed When the Service Center Is Attempted to Be Connected

Message "Invalid request, header is invalid, ak sk or project is empty." Is Displayed When the Service Center Is Attempted to Be Connected

Developers can use the service center provided by the public cloud to develop services. To use the service center, a developer must register an account and generate AK/SK information in My Credential for access authentication control. For details about how to access the public cloud, see Accessing Applications to ServiceComb Engines.

Abnormal message

{"errorCode":"401002","errorMessage":"Request unauthorized","detail":"Invalid request, header is invalid, ak sk or project is empty."}

Cause

The AK and SK are not correctly set or carried in the request header.

Diagnosis method

Check whether the project depends on the following authentication modules. (Check whether indirect dependency exists, for example, whether the project depends on cse-solution-service-engine.)

<groupId>com.huawei.paas.cse</groupId> 
<artifactId>foundation-auth</artifactId> 

Check whether AK/SK configurations in microservice.yaml are correct. Generally, the SK is longer than the AK.

cse:   
  credentials:     
    accessKey: your access key     
    secretKey: your serect key     
    akskCustomCipher: default 

Specifically, log in to the public cloud and query the AK information in My Credential. The SK is saved by the user and cannot be queried. If you forget the related credential, delete the credential information and create new credential information.