How to change php-opencloud Openstack from Keystone API v2 to v3 for OVH

If you are OVH customer and you are using the OVHCloud, you may receive email as below.

Email from OVH

Dear customer,
A few weeks ago, we notified you by email[1] that we are discontinuing v2 of the Keystone API on 24th March 2020. All users of the Keystone API must now use version 3, and make the changes required to do so.
Our last analysis shows that you have still been using v2 of the API recently (between Friday 14th February and Friday 21st February):

With most updates of this nature, you just need to modify the endpoint and the API version, but this change requires specific attention, which must be executed before 24th March 2020. Please, keep in mind this is a breaking change and the old Keystone V2 service won’t work anymore after this date. Please update your tools or applications accordingly.
You can find more information on our status page[2].
Thank you once again for choosing OVHcloud.
The Public Cloud Team

If you are using php-opencloud/openstack and was using API v2, you should update the code to v3.

Keystone API v2 for php-opencloud Openstack

use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
use OpenStack\Common\Transport\Utils as TransportUtils;
use OpenStack\Identity\v2\Service;
use OpenStack\OpenStack;

$authUrl = '';

$httpClient = new Client([
    'base_uri' => TransportUtils::normalizeUrl($authUrl),
    'handler'  => HandlerStack::create(),

$options = [
    'authUrl'         => $authUrl,
    'region'          => '{region}',
    'username'        => '{username}',
    'password'        => '{password}',
    'tenantName'      => '{tenantName}',
    'identityService' => Service::factory($httpClient),

$openstack = new OpenStack($options);

You should change to the example below.

Keystone API v3 for php-opencloud Openstack

use OpenStack\OpenStack;
$openstack = new OpenStack([
	'authUrl' => '',
	'region'  => '{region}',
	'user'    => [
		'name' => '{username}',
		'domain'   => [
			'id' => 'default'
		'password' => '{password}',
	'scope' => [
        'project' => [
		'name' => '{tenantName}',
		'domain'   => [
			'id' => 'default'

You may read more from their documentation


Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.