Linkedin Strategy to do Oauth2 with Remix.run
The Linkedin strategy is a feature that allows users to authenticate against their Linkedin account. It is an extension of the OAuth2Strategy and is supported by Node.js and Cloudflare runtimes.
To install the Linkedin strategy, follow the steps below:
npm install passport-linkedin-oauth2
const passport = require('passport');
const LinkedInStrategy = require('passport-linkedin-oauth2').Strategy;
passport.use(new LinkedInStrategy({
clientID: LINKEDIN_CLIENT_ID,
clientSecret: LINKEDIN_CLIENT_SECRET,
callbackURL: "http://localhost:3000/auth/linkedin/callback",
scope: ['r_emailaddress', 'r_liteprofile'],
}, function(accessToken, refreshToken, profile, done) {
// Add your authentication logic here
// ...
}));
app.get('/auth/linkedin', passport.authenticate('linkedin'));
app.get('/auth/linkedin/callback', passport.authenticate('linkedin', {
successRedirect: '/',
failureRedirect: '/login',
}));
The Linkedin strategy is a useful feature that allows users to authenticate using their Linkedin accounts. It requires the setup of an OAuth application on Linkedin’s developers page, as well as the configuration of routes for authentication. Overall, it offers a secure and convenient method for user authentication.