func (t *Tokens) PostLogin(ctx context.Context, creds apitypes.LoginCredential) (*base64.Value, string, error) {
	salt := loginTokenResponse{}

	var body interface{}
	switch creds.Type() {
	case apitypes.UserSession:
		body = &loginTokenUserRequest{
			Type:  tokenTypeLogin,
			Email: creds.Identifier(),
		}
	case apitypes.MachineSession:
		body = &loginTokenMachineRequest{
			Type:    tokenTypeLogin,
			TokenID: creds.Identifier(),
		}
	}

	req, err := t.client.NewRequest("POST", "/tokens", nil, body)
	if err != nil {
		log.Printf("Error building http request: %s", err)
		return salt.Salt, salt.Token, err
	}

	resp, err := t.client.Do(ctx, req, &salt)
	if err != nil && resp != nil && resp.StatusCode != 201 {
		log.Printf("Failed to get login token from server: %s", err)
	} else if err != nil {
		log.Printf("Error making api request: %s", err)
	}

	return salt.Salt, salt.Token, err
}
// PostLogin requests a login token from the registry for the provided email
// address.
PostLogin requests a login token from the registry for the provided email
address.
// PostLogin requests a login token from the registry for the provided email // address .
func (t *Tokens) PostLogin(ctx context.Context, creds apitypes.LoginCredential) (*base64.Value, string, error) {
	salt := loginTokenResponse{}
	var body interface{}
	switch creds.Type() {
	case apitypes.UserSession:
		body = &loginTokenUserRequest{
			Type:  tokenTypeLogin,
			Email: creds.Identifier(),
		}
	case apitypes.MachineSession:
		body = &loginTokenMachineRequest{
			Type:    tokenTypeLogin,
			TokenID: creds.Identifier(),
		}
	}
	req, err := t.client.NewRequest("POST", "/tokens", nil, body)
	if err != nil {
		log.Printf("Error building http request: %s", err)
		return salt.Salt, salt.Token, err
	}
	resp, err := t.client.Do(ctx, req, &salt)
	if err != nil && resp != nil && resp.StatusCode != 201 {
		log.Printf("Failed to get login token from server: %s", err)
	} else if err != nil {
		log.Printf("Error making api request: %s", err)
	}
	return salt.Salt, salt.Token, err
}
func ( t * Tokens ) PostLogin ( ctx context . Context , creds apitypes . LoginCredential ) ( * base64 . Value , string , error ) { salt := loginTokenResponse { } var body interface { } switch creds . Type ( ) { case apitypes . UserSession : body = & loginTokenUserRequest { Type : tokenTypeLogin , Email : creds . Identifier ( ) , } case apitypes . MachineSession : body = & loginTokenMachineRequest { Type : tokenTypeLogin , TokenID : creds . Identifier ( ) , } } req , err := t . client . NewRequest ( " " , " " , nil , body ) if err != nil { log . Printf ( " " , err ) return salt . Salt , salt . Token , err } resp , err := t . client . Do ( ctx , req , & salt ) if err != nil && resp != nil && resp . StatusCode != 201 { log . Printf ( " " , err ) } else if err != nil { log . Printf ( " " , err ) } return salt . Salt , salt . Token , err }
PostLogin requests a login token from the registry for the provided email
address.
PostLogin requests a login token from the registry for the provided email address .