jetoauth

1.0.1 • Public • Published

jetOauth



Easy implementation of OAuth2.0 login for express.


Support Providers

Service Developer Link Document URL
GoogleIcon Google Google Cloud Console Google OAuth2.0 Document
FacebookIcon Facebook Facebook Developers Facebook API Document
TwitterIcon Twitter Twitter Developer Twitter API Document
MicrosoftIcon Microsoft Azure Microsoft OAuth2.0 Document
YahooJapanIcon YahooJapan Yahooデベロッパーネットワーク YahooJapan API Document
PayPalIcon PayPal PayPal Developer PayPal Auth document
GitHubIcon GitHub GitHub Apps GitHub API Document
LINEIcon LINE LINE Developer LINE API Document
DiscordIcon Discord Discord Developer Discord API Document
RedditIcon Reddit Reddit developer application Reddit API Document
ImgurIcon Imgur Imgur API Imgur OAuth Document

Requirements

express express-cookie

Installation

Install via npm

npm install jetoauth

Install via yarn

yarn add jetoauth

Install via pnpm

pnpm add jetoauth

Example Usage

const express = require("express");
const jetOauth = require("jetoauth");
const cookieParser = require("cookie-parser");
const app = express();
app.use(cookieParser("jetOauth"));
app.use(
    jetOauth({
        providers: {
            discord: {
                client_id: process.env.discord_client_id,
                client_secret: process.env.discord_client_secret,
                scope: ["identify"],
            },
        },
    })
);

app.get("/info", (req, res) => {
    if (!req.jetOauth.isLogin) {
        res.send();
    } else {
        const obj = {};
        req.jetOauth.session.forEach((value, key) => {
            obj[key] = value;
        });
        res.json(obj);
    }
});

app.get("/login", (req, res) => {
    req.jetOauth.login("discord");
});

app.get("/jetoauth/success", (req, res) => {
    res.send("login success");
});

app.get("/jetoauth/fail", (req, res) => {
    res.send("failed to login");
});

app.listen(3000, () => {
    console.log("server is running on port 3000");
});

Login URL

https://{your domain}/jetoauth/login/{provider}

Callback URL

https://{your domain}/jetoauth/callback/{provider}

Contributers

Tonoyama Tonoyama

tsubasa652 tsubasa652

terusibata terusibata

kamitani2001 kamitani2001

noli-noli noli-noli

LICENSE

License: MIT

Readme

Keywords

none

Package Sidebar

Install

npm i jetoauth

Weekly Downloads

3

Version

1.0.1

License

MIT

Unpacked Size

31.9 kB

Total Files

19

Last publish

Collaborators

  • tsubasa652