Allow samples to use API key or alternate authentication endpoints if specified
diff --git a/acceptance/libargs.go b/acceptance/libargs.go
index 0c1d539..f30c9c9 100644
--- a/acceptance/libargs.go
+++ b/acceptance/libargs.go
@@ -17,6 +17,7 @@
 	username = os.Getenv("SDK_USERNAME")
 	password = os.Getenv("SDK_PASSWORD")
 	apiKey = os.Getenv("SDK_API_KEY")
+	var authURL = os.Getenv("OS_AUTH_URL")
 
 	if (provider == "") || (username == "") || (password == "") {
 		fmt.Fprintf(os.Stderr, "One or more of the following environment variables aren't set:\n")
@@ -26,6 +27,10 @@
 		os.Exit(1)
 	}
 
+	if strings.Contains(provider, "rackspace") && (authURL != "") {
+		provider = authURL + "/v2.0/tokens"
+	}
+
 	return
 }
 
@@ -141,6 +146,15 @@
 // withIdentity authenticates the user against the provider's identity service, and provides an
 // accessor for additional services.
 func withIdentity(ar bool, f func(gophercloud.AccessProvider)) {
+	_, _, _, apiKey := getCredentials()
+	if len(apiKey) == 0 {
+		withPasswordIdentity(ar, f)
+	} else {
+		withAPIKeyIdentity(ar, f)
+	}
+}
+
+func withPasswordIdentity(ar bool, f func(gophercloud.AccessProvider)) {
 	provider, username, password, _ := getCredentials()
 	acc, err := gophercloud.Authenticate(
 		provider,
@@ -157,6 +171,23 @@
 	f(acc)
 }
 
+func withAPIKeyIdentity(ar bool, f func(gophercloud.AccessProvider)) {
+	provider, username, _, apiKey := getCredentials()
+	acc, err := gophercloud.Authenticate(
+		provider,
+		gophercloud.AuthOptions{
+			Username:    username,
+			ApiKey:      apiKey,
+			AllowReauth: ar,
+		},
+	)
+	if err != nil {
+		panic(err)
+	}
+
+	f(acc)
+}
+
 // withServerApi acquires the cloud servers API.
 func withServerApi(acc gophercloud.AccessProvider, f func(gophercloud.CloudServersProvider)) {
 	api, err := gophercloud.ServersApi(acc, gophercloud.ApiCriteria{