-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need Example of Refresh Token. #34
Comments
There's already a Refresh Token usage example in the README.md var DiscordStrategy = require('passport-discord').Strategy
, refresh = require('passport-oauth2-refresh');
var discordStrat = new DiscordStrategy({
clientID: 'id',
clientSecret: 'secret',
callbackURL: 'callbackURL'
},
function(accessToken, refreshToken, profile, cb) {
profile.refreshToken = refreshToken; // store this for later refreshes
User.findOrCreate({ discordId: profile.id }, function(err, user) {
if (err)
return done(err);
return cb(err, user);
});
});
passport.use(discordStrat);
refresh.use(discordStrat); |
but what is |
Take it as a reference to a database called "User", find the user by their ID or create one if it doesn't exist |
I'm struggling to understand this as well. I'm new to OAuth. I have added a 'login with discord' button to my express application and want to make sure users don't get logged out randomly. My app only uses Discord for authentication, and there are no plans to use the discord API beyond simply allowing users to log in. Do I need to use refresh tokens to keep users from being logged out randomly despite their activity? I worry that users can end up having something expire despite having just used my app the previous day, for example. If so, where do I use the refresh token? README.md has an example of how to use a refresh token, but not when to use one. Additionally, I'm also confused as to why the example puts |
Add example of refresh token in the example folder.
The text was updated successfully, but these errors were encountered: