MyGit

hoc081098/Refresh-Token-Sample

Fork: 17 Star: 125 (更新于 2024-11-21 05:15:47)

license: MIT

Language: Kotlin .

Android Refresh token with Retrofit, OkHttp, Kotlin Coroutines Mutex 🔂 When multiple requests hit 401 (HTTP_UNAUTHORIZED), only single Refresh token request will be executed. After successful refresh, all pending requests will be executed concurrently. Example of encryption Jetpack Proto DataStore with Tink. Secured Proto DataStore. This example app shows how you can encrypt your data when using Proto DataStore from Jetpack.

最后发布版本: 1.2.0 ( 2021-12-06 17:19:15)

GitHub网址

Android Refresh Token Sample :repeat_one:

  • Android Refresh token with Retrofit, OkHttp and Coroutines Mutex.
  • When multiple requests hit 401 (HTTP_UNAUTHORIZED), only single Refresh token request will be executed.
  • After successful refresh, all pending requests will be executed concurrently.
  • Store user and token using Proto DataStore from Jetpack.
  • This example app shows how you can encrypt your data when using Proto DataStore from Jetpack.

API Kotlin Build CI Hits License: MIT

Buy me a coffee

Liked some of my work? Buy me a coffee (or more likely a beer)

"Buy Me A Coffee"

Features

  • ✅ Refresh token only once for multiple requests
  • ✅ Log out user if refreshToken failed
  • ✅ Log out if user gets an error after first refreshing
  • ✅ Queue all requests while token is being refreshed

Run local server

cd server
npm i
npm run start
  • Change baseUrl (e.g. http://YOUR_ID_ADDRESS:3000/) at app/src/main/java/com/hoc081098/refreshtokensample/data/DataModule.kt
  • Change expiresIn (default value is 1 minute) at server/routes/index.js.

Find this repository useful? ❤️

Star this repository and follow me for next creations! Thanks for your support 💗💗.

最近版本更新:(数据更新于 2024-09-02 19:50:44)

2021-12-06 17:19:15 1.2.0

2021-08-19 04:03:54 1.1.0

2021-07-09 12:39:08 1.0.0

主题(topics):

android-coroutines-flow, android-coroutines-flow-mvvm, android-mvvm-coroutine, android-refresh-token, android-refresh-token-sample, android-retrofit, android-retrofit-auth, android-stateflow, coroutines-mutex, kotlin, kotlin-coroutine-flow, kotlin-coroutines-mutex, kotlin-coroutines-mvvm, kotlin-coroutines-stateflow, okhttp-interceptor, okhttp-refresh-token, okhttp-token, retrofit-refresh-token, retrofit-token, secured-datastore

hoc081098/Refresh-Token-Sample同语言 Kotlin最近更新仓库

2024-11-19 23:12:26 jellyfin/jellyfin-androidtv

2024-11-18 20:14:29 gkd-kit/gkd

2024-11-11 21:37:35 FooIbar/EhViewer

2024-11-01 20:22:27 EhViewer-NekoInverter/EhViewer

2024-11-01 16:15:30 tiann/KernelSU

2024-10-27 19:26:53 salvogiangri/KnoxPatch