Skip to content

Latest commit

 

History

History
158 lines (126 loc) · 2.75 KB

README.md

File metadata and controls

158 lines (126 loc) · 2.75 KB

KeyAuth JavaScript React Native Example by Samuele Radici

Example is Using API 1.2

Example Codes

Filling KeyAuth Class Constructor
const KeyAuthApp = new KeyAuth(
    '',      // Application Name
    '',     // Application OwnerId
    '',    // Application Secret
    '1.0' // Application Version
);
Initializing Application
await KeyAuthApp.Initialize();

General Features

NOTE: For each of these following functions, you can use a try/catch block to catch errors as login error

Example:
    try {
        const result = await keyAuthApp.login(username, password);
    } catch (error) {
        console.log("Login error: ", error); // Example: Invalid username or password
    }

Login
await KeyAuthApp.login("<USERNAME>", "<PASSWORD>");
Register
await KeyAuthApp.register("<USERNAME>", "<PASSWORD>", "<LICENSE/KEY>", "<OPTIONAL EMAIL>")
Forgot
await KeyAuthApp.forgot("<USERNAME>", "<EMAIL>");
License Login
await KeyAuthApp.license("<LICENSE/KEY>");
Upgrade an Account
await KeyAuthApp.upgrade("<USERNAME>", "<LICENSE/KEY>");

Variables
Get Public Variable
await KeyAuthApp.var("<VarId>");
Get User Variable
await KeyAuthApp.GetVar("<VarId>");
Set User Variable
await KeyAuthApp.SetVar("<VarId>", "<VarData>");

Banning Logged in User
await KeyAuthApp.ban();

File Downloads #REMOVED FOR THIS MOBILE EXAMPLE
await KeyAuthApp.file("<FileId>");

Webhooks
Normal Request with Params
await KeyAuthApp.webhook("<WebId>", "<Params>")
Webhook Request with Body & Content Type
await KeyAuthApp.webhook("<WebId>", "<Params>", "<Body>", "<Content Type>");
Discord Webhook Example
await KeyAuthApp.webhook("<WebId>", "", "{\"content\": \"webhook message here\",\"embeds\": null}", "application/json");

Checks
Check Session Status
await KeyAuthApp.check();
Check Blacklist Status
await KeyAuthApp.checkBlack();
Check / Fetch Online Users
await KeyAuthApp.fetchOnline();

Chats
Get 20 Latest Chat Messages
await KeyAuthApp.ChatGet();
Send Chat Message
await KeyAuthApp.ChatSend("<ChannelName>", "<Message>");

Logs
await KeyAuthApp.log("<Message>");

Additional / Extra Functions

Set/Change Console Title
await KeyAuthApp.setTitle("<NewTitle>");
Sleep is ms(s)
await KeyAuthApp.sleep("<1 sec = 1000ms>")