Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
api42client
Advanced tools
API42Client is a class that help you interacte with 42 school api and get users data
API42Client is a class that help you interacte with 42 school api and get users data
This is a Node.js module available through the npm registry.
Before installing, download and install Node.js.
If this is a brand new project, make sure to create a package.json
first with
the npm init
command.
Installation is done using the
npm install
command:
$ npm install api42client
run.js
import Authenticator from "api42client";
// you can see the attached screen shot to know where get this variables
const UID = "98a139943caaa7645f98b077445f8e84de4cb23e7668fb010a01b9c0ed20b8a4"; // Position -1-
const SECRET = "b34df710754fbe173bfd202cd0bfdf05fcdc4dda3f22b4d76459a2a1e1c35f"; // Position -2-
const REDIRECT_URI = "http://localhost:3000"; // Position -3-
// 42 authenticator instance
var app = new Authenticator(UID, SECRET, REDIRECT_URI);
// after send the user to 42 site to authorize the app [example of 42 site: https://api.intra.42.fr/oauth/authorize?client_id=98a139f98b077445f8e84de4cb23e7668fb010a01b9c0ed20b8a4&redirect_uri=http%3A%2F%2Flocalhost%3A3000&response_type=code]
// 42 redirect the user to the REDIRECT_URI (in this example is: http://localhost:3000) with the code in query string
// like that: http://localhost:3000/?code=7a0cb1a9c5b0fd31a0eb9c5f854fc2386b1edc2179f73c76904d65f5aae4e9bc
// get the code from the query string (code=7a0cb1a9c5b0fd31a0eb9c5f854fc2386b1edc2179f73c76904d65f5aae4e9bc)
// and give it to get_Access_token function like below
var token = app.get_Access_token("85a7e9c0bdbb53d6583064846c087e5e499b6b523f0602c46d1d422078feaf77");
token.then((data) => {
// get the acces token of the user
console.log("======================== auth user Data =========================");
console.log(data);
console.log("========================= 42 user data ==========================");
// get the user info from 42 api
app.get_user_data(data.access_token).then((data) => {
console.log(data);
console.log("=============================================================");
});
}).catch((err) => {
console.log(err);
});
npm i api42client
Position -1-
with your values in 42 app (like in picture)Position -2-
with your values in 42 app (like in picture)Position -3-
with your values in 42 app (like in picture)code=7a0c...5f5aa9bc
)index.mjs
filenode run.js
Finally Congratulations 🎉 you will get all user info from 42 api
[I am very 😀 about every coffee!]
FAQs
API42Client is a class that help you interacte with 42 school api and get users data
The npm package api42client receives a total of 18 weekly downloads. As such, api42client popularity was classified as not popular.
We found that api42client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.