Skip to content

Commit 8047af0

Browse files
author
Aidan Laing
committed
Token Expiry Serialization
Added GSON serialized names to token expiresAt and refreshExpiresAt
1 parent 77a525c commit 8047af0

File tree

1 file changed

+2
-2
lines changed
  • mobileauthentication/src/main/java/ca/bc/gov/mobileauthentication/data/models

1 file changed

+2
-2
lines changed

mobileauthentication/src/main/java/ca/bc/gov/mobileauthentication/data/models/Token.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ data class Token(
1515
@SerializedName("id_token") val idToken: String?,
1616
@SerializedName("not-before-policy") val notBeforePolicy: Long?,
1717
@SerializedName("session_state") val sessionState: String?,
18-
val expiresAt: Long = System.currentTimeMillis() + (expiresIn ?: 0 * 1000),
19-
val refreshExpiresAt: Long = System.currentTimeMillis() + (refreshExpiresIn ?: 0 * 1000)
18+
@SerializedName("expires_at") val expiresAt: Long = System.currentTimeMillis() + ((expiresIn ?: 0) * 1000),
19+
@SerializedName("refresh_expires_at") val refreshExpiresAt: Long = System.currentTimeMillis() + ((refreshExpiresIn ?: 0) * 1000)
2020
) {
2121

2222
fun isExpired(currentTime: Long = System.currentTimeMillis()): Boolean = expiresAt > currentTime

0 commit comments

Comments
 (0)