passport-mgzon
v1.0.2
Published
Passport strategy for authenticating with MGZon using OAuth 2.0
Maintainers
Readme
Passport-MGZon
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
Requirements
- Node.js and npm (or yarn)
- Passport library
- A MGZon account to access user data via OAuth 2.0.
Installation
1. Install required packages:
npm install passport-mgzon
## Usage
## Authentication
```bash
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);
}));
```bash
## Routes
```bash
app.get('/auth/mgz', passport.authenticate('mgzon'));
app.get('/auth/mgz/callback', passport.authenticate('mgzon', { session: false }), (req, res) => {
res.redirect('/profile');
});
## 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">
2. **Use the Icon**:
Use the MGZon icon in your HTML:
```bash
<i class="icon-mgzon"></i> Sign in with MGZon
## File Structure
```bash
passport-mgzon/
├── index.js
├── icons/
│ ├── css/
│ │ └── style.css
│ ├── fonts/
│ │ ├── icomoon.eot
│ │ ├── icomoon.svg
│ │ ├── icomoon.ttf
│ │ ├── icomoon.woff
│ ├── svgs/
│ │ ├── mgzon.svg
│ │ ├── markai.svg
│ ├── demo.html
│ └── selection.json
## Development
**To test locally:**
```bash
npm install
npm test