Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions android/src/main/java/com/googleauth/GoogleAuthModule.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.googleauth

import android.app.Activity
import android.content.Context
import android.content.SharedPreferences
import android.util.Log
import androidx.lifecycle.Lifecycle
Expand Down Expand Up @@ -32,10 +31,8 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.util.Date
import java.util.concurrent.TimeUnit
import org.json.JSONObject
import java.util.Base64
import android.util.Base64

@ReactModule(name = GoogleAuthModule.NAME)
class GoogleAuthModule(reactContext: ReactApplicationContext) :
Expand Down Expand Up @@ -867,7 +864,7 @@ class GoogleAuthModule(reactContext: ReactApplicationContext) :
try {
val parts = idToken.split(".")
if (parts.size >= 2) {
val payload = String(Base64.getUrlDecoder().decode(parts[1]))
val payload = String(Base64.decode(parts[1], Base64.URL_SAFE))
val json = JSONObject(payload)
val exp = json.optLong("exp", 0)
if (exp > 0) {
Expand All @@ -883,7 +880,7 @@ class GoogleAuthModule(reactContext: ReactApplicationContext) :
try {
val parts = idToken.split(".")
if (parts.size >= 2) {
val payload = String(Base64.getUrlDecoder().decode(parts[1]))
val payload = String(Base64.decode(parts[1], Base64.URL_SAFE))
val json = JSONObject(payload)
return json.optString("email", null)
}
Expand Down
Loading