Replace clouddevices with weave in documentation and tests Removed OAuth scope parameter as optional. BUG:25627281 Change-Id: I1b2bce5b86fd7a0be89c446b5a13cc9c49244992 Reviewed-on: https://weave-review.googlesource.com/1538 Reviewed-by: Alex Vakulenko <avakulenko@google.com> (cherry picked from commit 88272d5b9e88dfd253c18aea4792fe57ee51696d) Reviewed-on: https://weave-review.googlesource.com/1542 Reviewed-by: Vitaly Buka <vitalybuka@google.com>
diff --git a/examples/daemon/README b/examples/daemon/README index c767420..ef52a47 100644 --- a/examples/daemon/README +++ b/examples/daemon/README
@@ -28,7 +28,7 @@ - "Step 2", "Exchange authorization code for tokens" - "Step 3", obtain a registration ticket for your new weave device HTTP Method: POST - Request URI: https://www.googleapis.com/clouddevices/v1/registrationTickets + Request URI: https://www.googleapis.com/weave/v1/registrationTickets Enter request body: { "userEmail": "me" @@ -36,7 +36,7 @@ then "Send the request", a ticket id will be returned in { "userEmail": "user@google.com", - "kind": "clouddevices#registrationTicket", + "kind": "weave#registrationTicket", "expirationTimeMs": "1443204934855", "deviceId": "0f8a5ff5-1ef0-ec39-f9d8-66d1caeb9e3d", "creationTimeMs": "1443204694855", @@ -80,7 +80,7 @@ - go to the oauthplayground used for registration ticket command in "Step 3", send base.identify with HTTP Method: POST - Request URI: https://www.googleapis.com/clouddevices/v1/commands + Request URI: https://www.googleapis.com/weave/v1/commands Enter request body: { "deviceId": "0f8a5ff5-1ef0-ec39-f9d8-66d1caeb9e3d", @@ -99,11 +99,11 @@ except in "step 3", do: HTTP Method: GET [not POST anymore] - Request URI: https://www.googleapis.com/clouddevices/v1/commands?deviceId=0f8a5ff5-1ef0-ec39-f9d8-66d1caeb9e3d + Request URI: https://www.googleapis.com/weave/v1/commands?deviceId=0f8a5ff5-1ef0-ec39-f9d8-66d1caeb9e3d "Send the request", you get all of the commands executed on your device, find something like - "kind": "clouddevices#command", + "kind": "weave#command", "name": "_sample._hello", "results": { "_reply": "Hello cloud user"
diff --git a/src/device_registration_info.cc b/src/device_registration_info.cc index 8945b66..d2b10a9 100644 --- a/src/device_registration_info.cc +++ b/src/device_registration_info.cc
@@ -606,7 +606,6 @@ {"client_id", GetSettings().client_id}, {"client_secret", GetSettings().client_secret}, {"redirect_uri", "oob"}, - {"scope", "https://www.googleapis.com/auth/clouddevices"}, {"grant_type", "authorization_code"}}); sender2.Send(base::Bind(&DeviceRegistrationInfo::RegisterDeviceOnAuthCodeSent, weak_factory_.GetWeakPtr(), cloud_id, robot_account,
diff --git a/src/device_registration_info.h b/src/device_registration_info.h index f3bacc6..9d9d21f 100644 --- a/src/device_registration_info.h +++ b/src/device_registration_info.h
@@ -85,20 +85,20 @@ // Returns the GCD service request URL. If |subpath| is specified, it is // appended to the base URL which is normally - // https://www.googleapis.com/clouddevices/v1/". + // https://www.googleapis.com/weave/v1/". // If |params| are specified, each key-value pair is formatted using // WebParamsEncode() and appended to URL as a query // string. // So, calling: // GetServiceURL("ticket", {{"key","apiKey"}}) // will return something like: - // https://www.googleapis.com/clouddevices/v1/ticket?key=apiKey + // https://www.googleapis.com/weave/v1/ticket?key=apiKey std::string GetServiceURL(const std::string& subpath = {}, const WebParamList& params = {}) const; // Returns a service URL to access the registered device on GCD server. // The base URL used to construct the full URL looks like this: - // https://www.googleapis.com/clouddevices/v1/devices/<cloud_id>/ + // https://www.googleapis.com/weave/v1/devices/<cloud_id>/ std::string GetDeviceURL(const std::string& subpath = {}, const WebParamList& params = {}) const;
diff --git a/src/device_registration_info_unittest.cc b/src/device_registration_info_unittest.cc index 91b8ff5..9edd396 100644 --- a/src/device_registration_info_unittest.cc +++ b/src/device_registration_info_unittest.cc
@@ -217,15 +217,13 @@ TEST_F(DeviceRegistrationInfoTest, GetOAuthURL) { EXPECT_EQ(test_data::kOAuthURL, dev_reg_->GetOAuthURL()); std::string url = test_data::kOAuthURL; - url += "auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fclouddevices&"; - url += "redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&"; + url += "auth?redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&"; url += "response_type=code&"; url += "client_id="; url += test_data::kClientId; EXPECT_EQ(url, dev_reg_->GetOAuthURL( "auth", - {{"scope", "https://www.googleapis.com/auth/clouddevices"}, - {"redirect_uri", "urn:ietf:wg:oauth:2.0:oob"}, + {{"redirect_uri", "urn:ietf:wg:oauth:2.0:oob"}, {"response_type", "code"}, {"client_id", test_data::kClientId}})); } @@ -332,7 +330,7 @@ json.SetString("channel.supportedType", "xmpp"); json.SetString("deviceKind", "vendor"); json.SetString("id", test_data::kDeviceId); - json.SetString("kind", "clouddevices#device"); + json.SetString("kind", "weave#device"); callback.Run(ReplyWithJson(200, json), nullptr); }))); @@ -427,13 +425,13 @@ base::DictionaryValue json_resp; json_resp.SetString("id", test_data::kClaimTicketId); - json_resp.SetString("kind", "clouddevices#registrationTicket"); + json_resp.SetString("kind", "weave#registrationTicket"); json_resp.SetString("oauthClientId", test_data::kClientId); base::DictionaryValue* device_draft = nullptr; EXPECT_TRUE(json->GetDictionary("deviceDraft", &device_draft)); device_draft = device_draft->DeepCopy(); device_draft->SetString("id", test_data::kDeviceId); - device_draft->SetString("kind", "clouddevices#device"); + device_draft->SetString("kind", "weave#device"); json_resp.Set("deviceDraft", device_draft); callback.Run(ReplyWithJson(200, json_resp), nullptr); @@ -447,11 +445,11 @@ Invoke([](const HttpClient::SendRequestCallback& callback) { base::DictionaryValue json; json.SetString("id", test_data::kClaimTicketId); - json.SetString("kind", "clouddevices#registrationTicket"); + json.SetString("kind", "weave#registrationTicket"); json.SetString("oauthClientId", test_data::kClientId); json.SetString("userEmail", "user@email.com"); json.SetString("deviceDraft.id", test_data::kDeviceId); - json.SetString("deviceDraft.kind", "clouddevices#device"); + json.SetString("deviceDraft.kind", "weave#device"); json.SetString("deviceDraft.channel.supportedType", "xmpp"); json.SetString("robotAccountEmail", test_data::kRobotAccountEmail); json.SetString("robotAccountAuthorizationCode", @@ -471,10 +469,7 @@ EXPECT_EQ(test_data::kClientId, GetFormField(data, "client_id")); EXPECT_EQ(test_data::kClientSecret, GetFormField(data, "client_secret")); - EXPECT_EQ("oob", GetFormField(data, "redirect_uri")); - EXPECT_EQ("https://www.googleapis.com/auth/clouddevices", - GetFormField(data, "scope")); base::DictionaryValue json; json.SetString("access_token", test_data::kAccessToken);
diff --git a/src/weave_unittest.cc b/src/weave_unittest.cc index f009814..c2f1e8f 100644 --- a/src/weave_unittest.cc +++ b/src/weave_unittest.cc
@@ -56,7 +56,7 @@ })"; const char kDeviceResource[] = R"({ - "kind": "clouddevices#device", + "kind": "weave#device", "id": "CLOUD_ID", "channel": { "supportedType": "pull" @@ -96,7 +96,7 @@ })"; const char kRegistrationResponse[] = R"({ - "kind": "clouddevices#registrationTicket", + "kind": "weave#registrationTicket", "id": "TICKET_ID", "deviceId": "CLOUD_ID", "oauthClientId": "CLIENT_ID", @@ -106,7 +106,7 @@ })"; const char kRegistrationFinalResponse[] = R"({ - "kind": "clouddevices#registrationTicket", + "kind": "weave#registrationTicket", "id": "TICKET_ID", "deviceId": "CLOUD_ID", "oauthClientId": "CLIENT_ID",