Code to log into a bundle account. Will return false if the user is not authorised, otherwise will return the account token of the user.

function bundleLogin() {
    let __Bundle__username = prompt("Bundle username...");
    if(__Bundle__username == null) return false;
    let __Bundle__password = prompt("Bundle password...");
    if(__Bundle__password == null) return false;

    postData('https://bundle-api.lankybox02.repl.co/account/login', { username: __Bundle__username, password: __Bundle__password })
    .then(data => {
        __Bundle__username = "";
        __Bundle__password = "";
        if (data.success) {
            return data.token;
        }else{
            return false;
        }
    });
}

by the way the api link is temporary, it will be changed as soon as i get my server*

Yeah, what are you thinking the new domain will be?

honestly idk

It’d probably be a good idea to figure that out

In python i could just do this but idk why

import requests
username = input('Username:')
password = input('Password')
req = requests.get('https://bundle-api.lankybox02.repl.co/account/login', json={'username': username, 'password': password})
if error in req.text:
   print('Error')
else:
   token = (req.text).get('token')
   print('Logged in.')

I think

oh also the token var should actaully be:

token = ((req.ext).ast.literal_eval).get('token')

View all comments