- 
                Notifications
    
You must be signed in to change notification settings  - Fork 267
 
Open
Description
grant config
app.use(grant({
  defaults: {
   "protocol": "http",
    "host": "localhost:5001",
    "prefix": "",  // Leave prefix empty to avoid '/auth/' prefix for other routes
    "transport": "session",
    "state": true,
    "response": "json",
    "debug": true
  },
  discord: {
    key: process.env.DISCORD_CLIENT_KEY,
    secret: process.env.DISCORD_SECRET_KEY,
    scope: ['identify', 'email'],
    callback: '/auth/discord/callback'
  },
  twitter: {
    key: process.env.TWITTER_CONSUMER_KEY,
    secret: process.env.TWITTER_CONSUMER_SECRET,
    callback: '/auth/twitter/callback',
    scope: ['users.read']
  },
  google: {
    key: process.env.GOOGLE_CLIENT_ID,
    secret: process.env.GOOGLE_CLIENT_SECRET,
    scope: ['profile', 'email'],
    callback: '/auth/google/callback'
  }
}));redirect URL
app.get('/auth/:provider/callback', (req, res) => {
  console.log("Req Query", req.query);
  const { provider } = req.params;
  res.send('Hello World!')
});Incoming redirected requests are affected by the default prefix. If we give /auth as a prefix then it will block the redirect URL /auth/:provider/callback and if we leave this as empty then it sends undefined in the callback URL.
Metadata
Metadata
Assignees
Labels
No labels