Skip to content

Latest commit

 

History

History
60 lines (40 loc) · 1.36 KB

README.md

File metadata and controls

60 lines (40 loc) · 1.36 KB

Intra API

Introduction

Intra API is a Node.js application that interacts with the 42 API to fetch user data and perform various other API requests. This project is designed to demonstrate how to make authenticated requests to the 42 API using OAuth2 client credentials.

Logo

Installation

Clone the project and the necessary dependencies:

git clone https://github.com/Emsa001/intra_api.git
cd ./intra_api
npm install

Configuration

Create a .env file in the root of your project and add the following environment variables:

INTRA_UID=your_intra_client_id
INTRA_SECRET=your_intra_client_secret

Usage

To start the application, use the following command:

npm start

Example

Here's an example of how to use the Intra API:

import "dotenv/config";
import IntraRequest from "./intra";

const request = new IntraRequest(null);
const user = await request.get(`/v2/users/escura`, {});

console.log(user);

Features

  • Make GET, POST requests to the 42 API
  • Automatically handles OAuth2 token retrieval and refresh
  • Configurable through environment variables

Dependencies

  • axios: ^1.6.8
  • dotenv: ^16.4.5

Authors