npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

maulana-oauth

v1.0.2

Published

merupakan module yang di gunakan untuk mengkoneksikan oauth laravel dll ke node js

Downloads

5

Readme

maulana-oauth

module yang di gunakan untuk menghubungkan oauth dari sso server seperti laravel passport ke dalam aplikasi node js, module ini menggunakan base module dari passport.js namun dibuat lebih ringkas dalam konfigurasi untuk mempermudah.

Instalisasi

 # instalisasi dengan npm
 npm i maulana-oauth
 # instalisasi dengan pnpm
 pnpm i maulana-oauth

Penggunaan

Konfigurasi pada app.js

const  oauth  =  require('maulana-oauth')

// Inisialisasi SSO
app.use(oauth.init());

// Pengaturan session
app.use(oauth.session());

Konfigurasi file .env

setelah melakukan konfigurasi app.js perlu di lakukan konfigurasi pada file .env untuk menambahkan variabel pendukung.

AUTHORIZATION_URL=https://server.dev/oauth/authorize
TOKEN_URL=https://server.dev/oauth/token
CLIENT_ID=<client_id>
CLIENT_SECRET=<secret_id>
CALLBACK_URL=https://client.dev/callback
SCOPE=view-user
OAUTH_PUBLICKEY = <path_publicKey>

|Parameter| Keterangan | |--|--| | AUTHORIZATION_URL | url authorization dari server SSO/oauth misalkan https://server.dev/oauth/authorize | |TOKEN_URL| url token dari SSO/oauth untuk request accessToken misalkan https://server.dev/oauth/token | |CLIENT_ID| client id dari server SSO/oauth| |CLIENT_SECRET| Client Secret dari server SSO/oauth| |CALLBACK_URL| Callback url untuk melakukan request accessToken misalkan https://client.dev/callback| |SCOPE| scope yang akan di request oleh aplikasi ke sso server | |OAUTH_PUBLICKEY| public key dari sso server untuk proses verifikasi jwt secara mandiri di aplikasi |

Menambahkan route /login

route ini digunakan untuk menampilkan page sso login dengan cara meredirect ke page sso login

app.get('/login', oauth.redirect());

Menambahkan route /callback

route ini digunakan untuk melakukan request accessToken

app.get('/callback', oauth.callback('/login'), (req, res) => {
    oauth.auth(req, res)
});

|Fungsi| Keterangan | |--|--| | oauth.callback(RouteLogin) | digunakan untuk request accessToken RouteLogin digunakan jika proses gagal maka akan di arahkan ke RouteLogin | |oauth.auth(req, res)| digunakan untuk menyimpan session login dan mendapatkan accessToken| |oauth.userId(req, res)| digunakan untuk mendapatkan userID dari sso server|