Skip to content

Commit

Permalink
Merge branch 'master' into signup_new_user
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobCube authored Jan 22, 2025
2 parents 9984757 + 7fa762b commit b5e3d0d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 29 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ You can add the library via Gradle:

```kotlin
dependencies {
implementation("dev.gitlive:firebase-java-sdk:0.4.7")
implementation("dev.gitlive:firebase-java-sdk:0.4.8")
}
```

Expand All @@ -35,7 +35,7 @@ Or Maven:
<dependency>
<groupId>dev.gitlive</groupId>
<artifactId>firebase-java-sdk</artifactId>
<version>0.4.7</version>
<version>0.4.8</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=0.4.7
version=0.4.8
46 changes: 20 additions & 26 deletions src/main/java/com/google/firebase/auth/FirebaseAuth.kt
Original file line number Diff line number Diff line change
Expand Up @@ -550,38 +550,32 @@ class FirebaseAuth constructor(
.takeUnless { it.task.isComplete }
?: enqueueRefreshTokenCall(user)
refreshSource.task.addOnSuccessListener { source.setResult(map(it)) }
refreshSource.task.addOnFailureListener { source.setException(FirebaseException(it.toString(), it)) }
refreshSource.task.addOnFailureListener { source.setException(it) }
}

private fun enqueueRefreshTokenCall(user: FirebaseUserImpl): TaskCompletionSource<FirebaseUserImpl> {
val source = TaskCompletionSource<FirebaseUserImpl>()
val body =
RequestBody.create(
json,
JsonObject(
mapOf(
"refresh_token" to JsonPrimitive(user.refreshToken),
"grant_type" to JsonPrimitive("refresh_token"),
),
).toString(),
)
val request =
Request
.Builder()
.url(urlFactory.buildUrl("securetoken.googleapis.com/v1/token"))
.post(body)
.tag(REFRESH_TOKEN_TAG)
.build()
val body = RequestBody.create(
json,
JsonObject(
mapOf(
"refresh_token" to JsonPrimitive(user.refreshToken),
"grant_type" to JsonPrimitive("refresh_token")
)
).toString()
)
val request = Request
.Builder()
.url(urlFactory.buildUrl("securetoken.googleapis.com/v1/token"))
.post(body)
.tag(REFRESH_TOKEN_TAG)
.build()

client.newCall(request).enqueue(
object : Callback {
override fun onFailure(
call: Call,
e: IOException,
) {
source.setException(e)
}
client.newCall(request).enqueue(object : Callback {

override fun onFailure(call: Call, e: IOException) {
source.setException(FirebaseException(e.toString(), e))
}
@Throws(IOException::class)
override fun onResponse(
call: Call,
Expand Down

0 comments on commit b5e3d0d

Please sign in to comment.