Major API Changes
Check URL is now https://api.rampagestudios.org/v1/oauth/request/index.php
New Scopes
Roblox Scopes
-
roblox_username
Roblox username
-
roblox_display
Roblox display name
-
roblox_id
Roblox user id
-
roblox_avatar_url
Roblox avatar (URL)
-
roblox_description
Roblox description
-
roblox_banstatus
Roblox Ban Status (boolean)
RAMPAGE Scopes
-
rampage_id
RAMPAGE User ID
-
rampage_email
RAMPAGE Email
Target Scopes
-
target_roblox
Must add this if you need roblox scopes (roblox_id, roblox_ username, etc)
-
target_rampage
Must add this if you need rampage scopes (rampage_id, rampage_email, etc)
If the target scopes are NOT added, you can’t interact with oAuth server to get the data.
New PHP Example
<?php
session_start();
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
function generate()
{
return sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));
}
// Format URL
$scopes = array("target_roblox", "roblox_username", "roblox_display", "roblox_id", "roblox_avatar_url"); // Add scopes you want here.
$return = "https://demo.vq9o.com/oauth/index.php"; // Return here.
// Format the URL (Do not touch)
$scopes = implode(',', $scopes); // Format to comma-seperated-value
$url = "https://id.rampagestudios.org/login/sso?scopes=" . rawurlencode($scopes) . "&return_url=" . rawurlencode($return);
// Handle URL
if (!empty($_GET["logout"])) {
echo "<b>Logged out!</b>";
setcookie(session_name(), '', 100);
session_unset();
session_destroy();
$_SESSION = array();
}
function GET($url, $fields)
{
$ch = curl_init($url);
$payload = json_encode($fields);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
return json_decode($result);
curl_close($ch);
}
if (!empty($_GET["target_roblox_key"])) {
$GeneratedCheckURL = "https://api.rampagestudios.org/v1/oauth/request/index.php";
$Fields = [
"key" => htmlspecialchars($_GET["target_roblox_key"]),
"platform" => "target_roblox"
];
$data = GET($GeneratedCheckURL, $Fields);
if ($data->success == true) {
$_SESSION["rampage_oauth_session"] = $data;
echo "<b>Authorized!</b>";
echo "<p>JSON:</p>". json_encode($data);
} else {
echo "<b>Login authorization key is expired!</b>";
}
} else {
if (!empty($_GET["failed"])) {
if (htmlspecialchars($_GET["failed"]) == true) {
echo "<b>Login failed due to: Pending Verification, No Account Found, No Roblox Account, or another error.</b>";
}
}
}
?>
<html>
<link rel="stylesheet" href="https://rampage.host/bulma.css">
<link rel="stylesheet" href="https://demo.vq9o.com/oauth/style.css">
<link rel="stylesheet" type="text/css" href="https://rampage.host/bulma_tooltip.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Manrope:wght@700;800&display=swap">
<nav class="navbar is-white topNav">
<div class="container">
<div class="navbar-brand">
<a class="navbar-item">
<p>Roblox <b>OAuth</b></p>
</a>
</div>
<div class=" navbar-end">
<div class="navbar-item">
<?php
if (empty($_SESSION["rampage_oauth_session"])) {
echo '<a class="button is-light" href="'. $url .'"><img height="25" width="25"
src="https://rampage.host/roblox.png" alt=""> Login</a>';
} else {
echo '<a class="button is-dark is-outlined" href="'. $return .'?logout=true"><img height="25" width="25"
src="https://rampage.host/roblox.png" alt=""> Logout</a>';
echo '<p class="image is-32x32 has-tooltip-bottom" data-tooltip="'. $_SESSION["rampage_oauth_session"]->roblox_username . '">
<img src="'.$_SESSION["rampage_oauth_session"]->roblox_avatar_url. '">
</p>';
}
?>
</div>
</div>
</div>
</nav>
</html>
New Javascript Example
const express = require("express");
const http = require('node-fetch');
const cookieSession = require('cookie-session')
const app = express();
const scopes = ["target_roblox", "roblox_username", "roblox_display", "roblox_id", "roblox_avatar_url"];
app.use(cookieSession({
name: 'rampage_oauth_session',
keys: ["securekey123"],
maxAge: 24 * 60 * 60 * 1000 // 24 hours
}));
app.get("/", (req, res) => {
if (!req.session.rampage_oauth_session.loggedin) return res.redirect(`http://localhost:${PORT}/login`);
res.redirect(`http://localhost:${PORT}/dashboard`);
});
app.get("/dashboard", (req, res) => {
if (!req.session.rampage_oauth_session.loggedin) return res.redirect(`http://localhost:${PORT}/login`);
res.send(req.session.rampage_oauth_session.data)
});
app.get("/logout", (req, res) => {
if (!req.session.rampage_oauth_session.loggedin) return res.redirect(`http://localhost:${PORT}/login`);
req.session = null;
res.send("Logged out!")
});
app.get("/authorize", (req, res) => {
const target_roblox_key = req.query.target_roblox_key;
if (!target_roblox_key) return console.log("No key found");
const response = await fetch('https://api.rampagestudios.org/v1/oauth/request/index.php', {
body: {
key: target_roblox_key,
platform: "roblox"
}
});
const data = await response.json();
if (!data.success) return console.log("Failed to verify success");
req.session.rampage_oauth_session.loggedin = true
req.session.rampage_oauth_session.data = data
res.redirect(`http://localhost:${PORT}/dashboard`);
});
app.get("/login", (req, res) => {
const scopesFormated = scopes.join(",");
const returnURL = `localhost:${PORT}/authorize`;
const redirect = `https://id.rampagestudios.org/login/sso?scopes=${encodeURIComponent(scopesFormated)}&return_url=${encodeURIComponent(returnURL)}`;
res.redirect(redirect);
});
const PORT = process.env.PORT || 8080;
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}.`);
});
More info at RAMPAGE OAuth - Community Tutorials - RAMPAGE.place