Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create key missing title , missing key #167

Closed
lukepolo opened this issue Jan 28, 2017 · 10 comments
Closed

Create key missing title , missing key #167

lukepolo opened this issue Jan 28, 2017 · 10 comments

Comments

@lukepolo
Copy link

When trying to create an ssh key im having this error

array:1 [▼
  "error" => "key is missing, title is missing"
]
$this->client->api('users')->createKey(
    $this->sshKeyLabel($site),
    $site->public_ssh_key
);

They are not empty, i checked. :-)

@m4tthumphrey
Copy link
Contributor

Are you using test as the title? Seems to be weird outcomes.

@lukepolo
Copy link
Author

Nope, I just did a request myself and seemed to work

@m4tthumphrey
Copy link
Contributor

So theres no issue?

@lukepolo
Copy link
Author

No i wrote it like :

 $client->post('https://gitlab.com/api/v3/projects/'.$repositoryInfo['id'].'/deploy_keys', [
            'Authorization' => 'Bearer '.$site->userRepositoryProvider->token,
            'Content-Type' => 'application/json',
        ], [
            'title' => 'CodePier',
            'key' => $site->public_ssh_key,
        ])->send();

Because it did not work through the package

@m4tthumphrey
Copy link
Contributor

m4tthumphrey commented Jan 30, 2017

I just did a quick test using the following

$gitlab = new Client('https://mygitlab.com/');
$gitlab->authenticate('...');

$gitlab->api('users')->createKey(
    'test',
    '...'
);

And it worked fine but I am running 7.13.5 so maybe something has changed in later versions. I can't see why what you just posted would work using the client directly and not via the package though...

@m4tthumphrey
Copy link
Contributor

Just noticed the content type.. it could well be todo with later versions requiring JSON input on specific methods?

@fbourigault
Copy link
Contributor

I tried this with 9.1.0 and it's working fine on gitlab.com.
Feel free to re-open this issue if issue is still valid for you.
Regards

@Yousha
Copy link

Yousha commented Mar 13, 2021

Same error when using package php-http/socket-client as psr/http-client-implementation .

Fixed by using package kriswallsmith/buzz instead.

@GrahamCampbell
Copy link
Member

@Yousha If you upgrade to the latest version of this package, this issue and many others are resolved.

@Yousha
Copy link

Yousha commented Mar 16, 2021

@GrahamCampbell Already using latest version, but it wasn't about the version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants