-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample.kt
More file actions
43 lines (35 loc) · 1.16 KB
/
Copy pathExample.kt
File metadata and controls
43 lines (35 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package pro.authon.sdk
fun main() {
val auth = Authon("your-app-id", "your-api-key")
// Connect
if (!auth.init()) {
println("[-] Failed to connect")
return
}
println("[+] Connected: ${auth.appName} v${auth.appVersion}")
// Auth
println("\n[1] Login\n[2] License Key")
print("\n> ")
val choice = readlnOrNull()?.trim()
val result = if (choice == "1") {
print("Username: "); val u = readlnOrNull()?.trim() ?: ""
print("Password: "); val p = readlnOrNull()?.trim() ?: ""
auth.login(u, p)
} else {
print("License Key: "); val k = readlnOrNull()?.trim() ?: ""
auth.license(k)
}
if (result["success"] != true) {
println("\n[-] ${result["message"]}")
return
}
println("\n[+] Authenticated!")
println(" Level: ${auth.level}")
println(" Subscription: ${auth.subscription ?: "None"}")
println(" Expires: ${auth.expiresAt ?: "Lifetime"}")
val msg = auth.getVar("welcome_message")
if (msg != null) println("\n[*] $msg")
auth.log("Kotlin SDK example executed")
println("\n[+] Done. Logging out...")
auth.logout()
}