Help Center> SoftWare Repository for Container> API Reference> API> Generating a Temporary Login Command

Generating a Temporary Login Command

Function

Generate a temporary login command using the value of X-Swr-Dockerlogin in the response header and the value of host in the response body.

URI

POST /v2/manage/utils/secret?projectname={projectname}

For details about parameters, see Table 1.

Table 1 Parameter description

Parameter

Mandatory

Type

Description

projectname

No

String

Project name. The default value is the region name, for example, cn-north-1.

Request

N/A

Response

Response parameters

Table 2 Response header parameter description

Parameter

Type

Description

X-Swr-Dockerlogin

String

A login command, for example, docker login -u cn-north-1@OW******FPUKBXI -p 6f0779072******863d1ae3ccef921b7f33

Table 3 Response body parameter description

Parameter

Type

Description

auths

Map<String, authInfo>

Authentication information

Table 4 authInfo parameter description

Parameter

Type

Description

auth

String

Base64-encoded authentication information

Response example

{
    "auths": {
        "10.95.181.176:5300": {
            "auth": "Y24tbm9ydGg******hhMTgzMGVmN2RhZjJm"
        }
    }
}

A temporary login command can be generated using the value of X-Swr-Dockerlogin in the response header and the value of host in the response body.

For example, in the preceding response example, the value of X-Swr-Dockerlogin in the response header is docker login -u cn-north-1@OW******FPUKBXI -p 6f0779072******863d1ae3ccef921b7f33. The value of host in the response body is 10.95.181.176:5300. Therefore, the generated temporary login command is as follows:

docker login -u cn-north-1@OW******FPUKBXI -p 6f0779072******863d1ae3ccef921b7f33 10.95.181.176:5300

Status Code

For details about status code, see Table 5.

Table 5 Status code

Status Code

Description

200

The request is successfully sent.

400

Request error. Error information is returned.

401

Authentication failed.

500

Internal error. Error information is returned.