Skip to content

Commit

Permalink
Addressing PR comments:
Browse files Browse the repository at this point in the history
  • Loading branch information
gpanshu committed Dec 6, 2023
1 parent 65eed58 commit 6bc8d52
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,6 @@ import com.amplifyframework.statemachine.codegen.states.SetupTOTPState
import com.amplifyframework.statemachine.codegen.states.SignInChallengeState
import com.amplifyframework.statemachine.codegen.states.SignInState
import com.amplifyframework.statemachine.codegen.states.SignOutState
import java.io.IOException
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicReference
import kotlin.coroutines.resume
import kotlin.coroutines.resumeWithException
import kotlin.coroutines.suspendCoroutine
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.async
Expand All @@ -184,6 +177,13 @@ import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.Response
import java.io.IOException
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicReference
import kotlin.coroutines.resume
import kotlin.coroutines.resumeWithException
import kotlin.coroutines.suspendCoroutine

internal class RealAWSCognitoAuthPlugin(
private val configuration: AuthConfiguration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ package com.amplifyframework.auth.cognito.helpers

import com.amplifyframework.auth.cognito.exceptions.service.InvalidParameterException
import com.amplifyframework.auth.exceptions.UnknownException
import org.json.JSONObject
import javax.crypto.Mac
import javax.crypto.spec.SecretKeySpec
import org.json.JSONObject

internal open class AuthHelper {

Expand Down Expand Up @@ -75,9 +75,9 @@ internal open class AuthHelper {
* @return the username from the magic link.
* */
fun getUsernameFromMagicLink(magicLinkCode: String): String? {
val header = magicLinkCode.split(".")[0]
val jsonString = android.util.Base64.decode(header, android.util.Base64.NO_WRAP)
return try {
val header = magicLinkCode.split(".")[0]
val jsonString = android.util.Base64.decode(header, android.util.Base64.NO_WRAP)
JSONObject(jsonString.toString(Charsets.UTF_8)).getString(USERNAME_KEY)
} catch (e: Exception) {
null
Expand Down

0 comments on commit 6bc8d52

Please sign in to comment.