Back to Browse

Google One Tap with Jetpack Compose, Ktor HttpClient, ActivityResultRegistry

463 views
Nov 1, 2022
19:54

Learn how I integrated Google One Tap with Jetpack Compose. My app uses a DefaultLifecycleObserver, Activity Result APIs, and ActivityResultLaunchers in an isolated class. With this design, the UI remains light, while the business layer does all of the work. This creates a strong separation of responsibility, in case the sign up process changes in the future. When my app gets the Google credentials, I send the Google JWT token to the backend Ktor API. I use Ktor HttpClient to send the requests, with a Bearer Authentication header that includes the JWT. I also include an Nonce in the header. My Ktor backend validates the Google token, and inserts or gets a new user. If you missed the first two videos: Demo & Setup: https://youtu.be/WsnNiQje1o8 Ktor JWT Validation: https://youtu.be/Q7PgQdXfETU Android app: https://github.com/santansarah/city-api-client/tree/ktor-network-api Ktor API: https://github.com/santansarah/ktor-city-api/tree/google-one-tap Google One Tap Guide: https://developers.google.com/identity/one-tap/android/overview Activity Result APIs: https://developer.android.com/training/basics/intents/result 0:00 Testing Google One Tap 1:37 Device setup 2:50 Store Android secrets 3:16 Gradle setup 3:54 Ktor HttpClient 5:25 Custom API error handling 7:26 Get User by id 7:40 One Tap manager 13:08 One Tap error handling 13:50 One Tap manager cont. 14:44 Handle configuration changes 15:37 Home Screen 16:26 User states 17:40 User repository 18:42 Viewmodel 19:11 Account screen

Download

0 formats

No download links available.

Google One Tap with Jetpack Compose, Ktor HttpClient, ActivityResultRegistry | NatokHD