First get the URL and token to display to the user
| 154 | |
| 155 | // First get the URL and token to display to the user |
| 156 | void 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 |
| 180 | void DeviceFlow::onDeviceAuthReplyFinished() |
nothing calls this directly
no test coverage detected