-
Notifications
You must be signed in to change notification settings - Fork 122
/
Copy pathcreate_auth_uri_request.cc
57 lines (48 loc) · 1.84 KB
/
create_auth_uri_request.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright 2017 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "auth/src/desktop/rpcs/create_auth_uri_request.h"
#include "app/src/assert.h"
#include "app/src/include/firebase/app.h"
#include "app/src/log.h"
namespace firebase {
namespace auth {
CreateAuthUriRequest::CreateAuthUriRequest(::firebase::App& app,
const char* api_key,
const char* identifier,
const char* tenant_id)
: AuthRequest(app, request_resource_data, true) {
FIREBASE_ASSERT_RETURN_VOID(api_key);
const char api_host[] =
"https://www.googleapis.com/identitytoolkit/v3/relyingparty/"
"createAuthUri?key=";
std::string url;
url.reserve(strlen(api_host) + strlen(api_key));
url.append(api_host);
url.append(api_key);
set_url(url.c_str());
if (identifier) {
application_data_->identifier = identifier;
} else {
LogError("No identifier given.");
}
if (tenant_id != nullptr){
application_data_->tenantId = tenant_id;
}
// This parameter is only relevant for the web SDK; for desktop, it can have
// any value as long as it passes the backend validation for a valid URL.
application_data_->continueUri = "http://localhost";
UpdatePostFields();
}
} // namespace auth
} // namespace firebase