Build v3 auth scope from AuthOptions
diff --git a/openstack/client.go b/openstack/client.go
index 7d67b15..1193b19 100644
--- a/openstack/client.go
+++ b/openstack/client.go
@@ -133,7 +133,25 @@
v3Client.Endpoint = endpoint
}
- result := tokens3.Create(v3Client, options, nil)
+ var scope *tokens3.Scope
+ if options.TenantID != "" {
+ scope = &tokens3.Scope{
+ ProjectID: options.TenantID,
+ }
+ options.TenantID = ""
+ options.TenantName = ""
+ } else {
+ if options.TenantName != "" {
+ scope = &tokens3.Scope{
+ ProjectName: options.TenantName,
+ DomainID: options.DomainID,
+ DomainName: options.DomainName,
+ }
+ options.TenantName = ""
+ }
+ }
+
+ result := tokens3.Create(v3Client, options, scope)
token, err := result.ExtractToken()
if err != nil {