Merge pull request #5189 from nextcloud/issue-fix-login-v2-poll-url

Fixed Login V2 Bug
This commit is contained in:
Marcel Hibbe 2025-07-28 12:22:16 +02:00 committed by GitHub
commit 8203ca691d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View File

@ -26,6 +26,8 @@ import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import java.lang.Boolean
import kotlin.Long
import kotlin.String
@RunWith(AndroidJUnit4::class)
class ChatBlocksDaoTest {
@ -58,6 +60,7 @@ class ChatBlocksDaoTest {
val account1 = usersDao.getUserWithUserId("account1").blockingGet()
conversationsDao.upsertConversations(
accountId = user.id,
listOf(
createConversationEntity(
accountId = account1.id,

View File

@ -85,6 +85,7 @@ class BrowserLoginActivity : BaseActivity() {
private val loginFlowExecutorService: ScheduledExecutorService? = Executors.newSingleThreadScheduledExecutor()
private var isLoginProcessCompleted = false
private var token: String = ""
private var pollUrl: String = ""
private lateinit var okHttpClient: OkHttpClient
@ -163,6 +164,7 @@ class BrowserLoginActivity : BaseActivity() {
launchDefaultWebBrowser(loginUrl)
}
token = jsonObject.getAsJsonObject("poll").get("token").asString
pollUrl = jsonObject.getAsJsonObject("poll").get("endpoint").asString
} catch (e: SSLHandshakeException) {
Log.e(TAG, "Error caught at anonymouslyPostLoginRequest: $e")
}
@ -215,14 +217,12 @@ class BrowserLoginActivity : BaseActivity() {
}
private fun performLoginFlowV2() {
val postRequestUrl = "$baseUrl/login/v2/poll"
val requestBody: RequestBody = FormBody.Builder()
.add("token", token)
.build()
val request = Request.Builder()
.url(postRequestUrl)
.url(pollUrl)
.post(requestBody)
.build()