Archived
Mengubah payload menjadi id
This commit is contained in:
1 parent
b8caa99035
commit
adb535e93c
5 files changed
+11
-11
No files matched your search
@@ -28,7 +28,7 @@ import java.security.SecureRandom
|
||||
|
||||
@InvokeArg
|
||||
class KirimArgs {
|
||||
var idKlien: String? = null
|
||||
var id: String? = null
|
||||
}
|
||||
|
||||
@TauriPlugin
|
||||
@@ -39,15 +39,15 @@ class AuthPlugin(private val activity: Activity) : Plugin(activity) {
|
||||
@Command
|
||||
fun masuk(invoke: Invoke) {
|
||||
val args = invoke.parseArgs(KirimArgs::class.java)
|
||||
val idKlien = args.idKlien
|
||||
if (idKlien.isNullOrEmpty()) {
|
||||
val id = args.id
|
||||
if (id.isNullOrEmpty()) {
|
||||
invoke.reject("ID Klien belum disediakan")
|
||||
return
|
||||
}
|
||||
|
||||
val googleIdOption: GetGoogleIdOption = GetGoogleIdOption.Builder()
|
||||
.setFilterByAuthorizedAccounts(true)
|
||||
.setServerClientId(idKlien)
|
||||
.setServerClientId(id)
|
||||
.setNonce(generateSecureRandomNonce())
|
||||
.build()
|
||||
|
||||
@@ -63,7 +63,7 @@ class AuthPlugin(private val activity: Activity) : Plugin(activity) {
|
||||
)
|
||||
handleSignInResult(result, invoke)
|
||||
} catch (e: NoCredentialException) {
|
||||
signInWithAllAccounts(idKlien, invoke)
|
||||
signInWithAllAccounts(id, invoke)
|
||||
} catch (e: GetCredentialException) {
|
||||
invoke.reject("Gagal masuk: ${e.message}")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user