MCPcopy Create free account
hub / github.com/MultiMC/Launcher / login

Method login

libraries/katabasis/src/DeviceFlow.cpp:156–177  ·  view source on GitHub ↗

First get the URL and token to display to the user

Source from the content-addressed store, hash-verified

154
155// First get the URL and token to display to the user
156void DeviceFlow::login() {
157 qDebug() << "DeviceFlow::link";
158
159 updateActivity(Activity::LoggingIn);
160 setLinked(false);
161 setToken("");
162 setExtraTokens(QVariantMap());
163 setRefreshToken(QString());
164 setExpires(QDateTime());
165
166 QList<RequestParameter> parameters;
167 parameters.append(RequestParameter(OAUTH2_CLIENT_ID, options_.clientIdentifier.toUtf8()));
168 parameters.append(RequestParameter(OAUTH2_SCOPE, options_.scope.toUtf8()));
169 QByteArray payload = createQueryParameters(parameters);
170
171 QUrl url(options_.authorizationUrl);
172 QNetworkRequest deviceRequest(url);
173 deviceRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
174 QNetworkReply *tokenReply = manager_->post(deviceRequest, payload);
175
176 connect(tokenReply, &QNetworkReply::finished, this, &DeviceFlow::onDeviceAuthReplyFinished, Qt::QueuedConnection);
177}
178
179// Then, once we get them, present them to the user
180void DeviceFlow::onDeviceAuthReplyFinished()

Callers

nothing calls this directly

Calls 5

QStringClass · 0.85
RequestParameterClass · 0.85
createQueryParametersFunction · 0.85
appendMethod · 0.80
postMethod · 0.80

Tested by

no test coverage detected