A quick crash course on using the Roblox API from Autocode
const axios = require('axios');
/**
* Return the logged in user
* @returns {object} body The generated message
* {number} id The logged in user's ID
* {string} name The logged in user's username
* {sting} displayName The logged in user's display name
*/
module.exports = async (context) => {
// For instructions on getting a Roblox session token visit:
// https://noblox.js.org/tutorial-Authentication.html
// NOTE: noblox.js does not work on Autocode, only follow
// the portion of this guide for fetching the ROBLOSECURITY
// token, then return to this snippet.
const {ROBLOX_TOKEN} = process.env.ROBLOX_TOKEN;
// For a list of Roblox APIs visit:
// https://roblox.fandom.com/wiki/List_of_web_APIs
const resp = await axios.get(
'https://users.roblox.com/v1/users/authenticated',
{
headers: {
Cookie: `.ROBLOSECURITY=${ROBLOX_TOKEN}`,
},
}
);
return resp.data;
};