Giter Club home page Giter Club logo

hoc081098 / refresh-token-sample Goto Github PK

View Code? Open in Web Editor NEW
113.0 2.0 16.0 609 KB

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.

License: MIT License

Kotlin 79.88% JavaScript 18.95% CSS 0.33% Pug 0.83%
android-refresh-token retrofit-refresh-token android-retrofit android-retrofit-auth android-refresh-token-sample okhttp-refresh-token okhttp-interceptor retrofit-token okhttp-token android-mvvm-coroutine

refresh-token-sample's Introduction

Android Refresh Token Sample ๐Ÿ”‚

  • 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 ๐Ÿ’—๐Ÿ’—.

refresh-token-sample's People

Contributors

hoc081098 avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

refresh-token-sample's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • Update dependency androidx.test.ext:junit to v1.1.5
  • Update dependency com.squareup.okhttp3:logging-interceptor to v5.0.0-SNAPSHOT
  • Update dependency androidx.appcompat:appcompat to v1.6.1
  • Update dependency androidx.datastore:datastore to v1.1.1
  • Update dependency androidx.test.espresso:espresso-core to v3.5.1
  • Update dependency com.diffplug.spotless:spotless-plugin-gradle to v6.25.0
  • Update dependency com.google.android.material:material to v1.12.0
  • Update dependency com.google.crypto.tink:tink-android to v1.13.0
  • Update dependency com.google.protobuf:protobuf-javalite to v3.25.3
  • Update dependency com.google.protobuf:protoc to v3.25.3
  • Update dependency com.squareup.moshi:moshi-kotlin to v1.15.1
  • Update dependency com.squareup.retrofit2:converter-moshi to v2.11.0
  • Update dependency com.squareup.retrofit2:retrofit to v2.11.0
  • Update dependency gradle to v7.6.4
  • Update dependency io.github.hoc081098:FlowExt to v0.8.0
  • Update dependency org.jetbrains.kotlin:kotlin-gradle-plugin to v1.9.23
  • Update dependency org.jetbrains.kotlinx:kotlinx-coroutines-android to v1.8.0
  • Update dependency org.jetbrains.kotlinx:kotlinx-coroutines-core to v1.8.0
  • Update lifecycle_version to v2.7.0 (androidx.lifecycle:lifecycle-runtime-ktx, androidx.lifecycle:lifecycle-viewmodel-ktx)
  • Update plugin com.google.protobuf to v0.9.4
  • Update actions/cache action to v4
  • Update actions/checkout action to v4
  • Update actions/setup-java action to v4
  • Update actions/upload-artifact action to v4
  • Update dependency com.android.tools.build:gradle to v8
  • Update dependency com.google.protobuf:protobuf-javalite to v4
  • Update dependency com.google.protobuf:protoc to v4
  • Update dependency gradle to v8
  • Update gradle/wrapper-validation-action action to v3
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/build.yml
  • actions/checkout v3
  • actions/setup-java v3
  • actions/cache v3
  • actions/upload-artifact v3
.github/workflows/gradle-wrapper-validation.yml
  • actions/checkout v3
  • gradle/wrapper-validation-action v1
.github/workflows/remove-old-artifacts.yml
  • c-hive/gha-remove-artifacts v1
.github/workflows/review-suggest.yml
  • actions/checkout v3
  • actions/checkout v3
  • actions/setup-java v3
  • actions/cache v3
  • reviewdog/action-suggester v1
gradle
gradle.properties
settings.gradle
build.gradle
  • com.android.tools.build:gradle 7.3.1
  • org.jetbrains.kotlin:kotlin-gradle-plugin 1.7.20-RC
  • com.google.dagger:hilt-android-gradle-plugin 2.44.2
  • com.diffplug.spotless:spotless-plugin-gradle 6.11.0
  • androidx.lifecycle:lifecycle-viewmodel-ktx 2.5.1
  • androidx.lifecycle:lifecycle-runtime-ktx 2.5.1
  • com.google.dagger:hilt-android 2.44.2
  • com.google.dagger:hilt-android-compiler 2.44.2
app/build.gradle
  • com.google.protobuf 0.8.19
  • androidx.core:core-ktx 1.8.0
  • androidx.appcompat:appcompat 1.5.1
  • com.google.android.material:material 1.6.1
  • androidx.constraintlayout:constraintlayout 2.1.4
  • androidx.activity:activity-ktx 1.5.1
  • junit:junit 4.13.2
  • androidx.test.ext:junit 1.1.3
  • androidx.test.espresso:espresso-core 3.4.0
  • com.squareup.moshi:moshi-kotlin 1.14.0
  • com.squareup.okhttp3:logging-interceptor 5.0.0-alpha.9
  • com.squareup.retrofit2:retrofit 2.9.0
  • com.squareup.retrofit2:converter-moshi 2.9.0
  • org.jetbrains.kotlinx:kotlinx-coroutines-core 1.6.4
  • org.jetbrains.kotlinx:kotlinx-coroutines-android 1.6.4
  • androidx.datastore:datastore 1.0.0
  • com.google.protobuf:protobuf-javalite 3.21.6
  • com.google.crypto.tink:tink-android 1.7.0
  • com.github.hoc081098:ViewBindingDelegate 1.4.0
  • io.github.hoc081098:FlowExt 0.4.0
  • com.jakewharton.timber:timber 5.0.1
  • com.google.protobuf:protoc 3.21.6
gradle-wrapper
gradle/wrapper/gradle-wrapper.properties
  • gradle 7.5.1
npm
server/package.json
  • cookie-parser ~1.4.4
  • debug ~2.6.9
  • express ^4.16.4
  • http-errors ~1.6.3
  • jade ~1.11.0
  • jsonwebtoken ^8.5.1
  • morgan ~1.9.1

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.