Skip to content

Commit f7421a4

Browse files
author
Kostadinos J Kyprianos
authored
Update README.md
app.get('/pledge', (req, res) => { const params = new URLSearchParams({ client_id: process.env.PAYPAL_CLIENT_ID, response_type: 'code', scope: 'openid email', redirect_uri: 'https://yourapp.example.com/auth/paypal/callback' }); res.redirect(`https://www.paypal.com/signin/authorize?${params}`); });
1 parent 224d1fb commit f7421a4

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
1-
![Sponsors](https://img.shields.io/github/sponsors/alexandros-thomson?style=for-the-badge)
1+
const passport = require('passport');
2+
const ORCIDStrategy = require('passport-orcid').Strategy;
3+
4+
passport.use(new ORCIDStrategy({
5+
clientID: process.env.ORCID_CLIENT_ID,
6+
clientSecret: process.env.ORCID_CLIENT_SECRET,
7+
callbackURL: 'https://yourapp.example.com/auth/orcid/callback'
8+
}, (accessToken, refreshToken, profile, done) => {
9+
// profile.id is the ORCID iD
10+
done(null, { orcid_id: profile.id });
11+
}));
12+
13+
// Routes
14+
app.get('/auth/orcid', passport.authenticate('orcid'));
15+
app.get('/auth/orcid/callback',
16+
passport.authenticate('orcid', { session: true }),
17+
(req, res) => {
18+
// Session now contains req.user.orcid_id
19+
res.redirect('/pledge');
20+
}
21+
);![Sponsors](https://img.shields.io/github/sponsors/alexandros-thomson?style=for-the-badge)
222
![Stars](https://img.shields.io/github/stars/alexandros-thomson/alexandros-thomson?style=for-the-badge)
323
![Watchers](https://img.shields.io/github/watchers/alexandros-thomson/alexandros-thomson?style=for-the-badge)
424
![Contributions](https://github-readme-stats.vercel.app/api?username=alexandros-thomson&show_icons=true&theme=radical)## Git Credential Manager

0 commit comments

Comments
 (0)