-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Token Refresh Implementation to Network Layer (#84)
* feat: Add Token Refresh Implementation to Network Layer It applies token authentication to the network requests before a network call is made. The expiry duration is saved and it is applied before a network request is queued. * refactor: Use milliseconds for expiry time
- Loading branch information
1 parent
a11faa3
commit d1bf1a6
Showing
8 changed files
with
176 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
auth/src/main/java/org/openedx/auth/domain/model/AuthResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.openedx.auth.domain.model | ||
|
||
import android.os.Parcelable | ||
import kotlinx.parcelize.Parcelize | ||
import org.openedx.core.utils.TimeUtils | ||
|
||
@Parcelize | ||
data class AuthResponse( | ||
var accessToken: String?, | ||
var tokenType: String?, | ||
var expiresIn: Long?, | ||
var scope: String?, | ||
var error: String?, | ||
var refreshToken: String?, | ||
) : Parcelable { | ||
fun getTokenExpiryTime(): Long { | ||
return (expiresIn ?: 0L) + TimeUtils.getCurrentTime() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.