DEV Community

Cover image for Passport MGZon
Mark EL-asfar
Mark EL-asfar

Posted on

Passport MGZon

 **Passport strategy for MGZon OAuth 2.0 authentication with icon support. is an OAuth 2.0 strategy for use with the Passport library, allowing authentication with MGZon.

This project simplifies the process of integrating MGZon authentication into your application using OAuth 2.0, enabling developers to authenticate users via their MGZon accounts.**

More Information

Check out the Gist for a quick start guide.

Passport-MGZon is an OAuth 2.0 strategy for use with the Passport library, allowing authentication with MGZon.

This project simplifies the process of integrating MGZon authentication into your application using OAuth 2.0, enabling developers to authenticate users via their MGZon accounts.

Demo Icon
MGZon Logo

How to Usage

  1. Authentication
const passport = require('passport');
const MGZonStrategy = require('passport-mgzon');

passport.use(new MGZonStrategy({
  clientID: process.env.MGZON_CLIENT_ID,
  clientSecret: process.env.MGZON_CLIENT_SECRET,
  callbackURL: 'http://your-app/auth/mgz/callback',
  scope: ['profile:read', 'profile:write']
}, async (accessToken, refreshToken, profile, done) => {
  // Your user handling logic here
  return done(null, profile);
}));
Enter fullscreen mode Exit fullscreen mode

**_

  1. Routes _**
app.get('/auth/mgz', passport.authenticate('mgzon'));

app.get('/auth/mgz/callback', passport.authenticate('mgzon', { session: false }), (req, res) => {
  res.redirect('/profile');
});
Enter fullscreen mode Exit fullscreen mode

How to Use MGZon Icon

  • This package includes the MGZon icon font. To use it:

Include the CSS:

  1. Include the CSS: Add the following line to your HTML or import it in your CSS/JS: html
   <link rel="stylesheet" href="/icons/css/style.css">
   <link rel="stylesheet" href="node_modules/passport-mgzon/icons/css/style.css">
Enter fullscreen mode Exit fullscreen mode
  1. Use the Icon: Use the MGZon icon in your HTML:
<i class="icon-mgzon"></i> Sign in with MGZon
Enter fullscreen mode Exit fullscreen mode

How to Installation

Install required packages:

npm install passport-mgzon


Enter fullscreen mode Exit fullscreen mode

Top comments (0)