Open justinmc opened 7 years ago
Hi Justin,
This project is still under development, I will get back at it in the upcoming weeks. As of now we still do not have a passport strategy ready. I will update you once I have something working for you.
Thanks, Jaime
@jaimerosales I actually got Forge OAuth2 working really easily just by using the passport-oauth2
strategy. Something like this:
passport.use(new OAuth2Strategy({
authorizationURL: 'https://developer.api.autodesk.com/authentication/v1/authorize',
tokenURL: 'https://developer.api.autodesk.com/authentication/v1/gettoken',
clientID: process.env.FORGE_CLIENT_ID,
clientSecret: process.env.FORGE_CLIENT_SECRET,
callbackURL: callbackURL,
},
(accessToken, refreshToken, profile, cb) => {
// Profile will be empty, need to fetch from Forge API
axios.get('https://developer.api.autodesk.com/userprofile/v1/users/@me', {
headers: {
Authorization: `Bearer ${accessToken}`,
},
}).then((res) => {
if (!res.data.userId) {
return cb(new Error('Invalid Forge user data received'));
}
// ...Find or create user etc. and call cb here
}).catch(cb);
}
));
And actually, installing via the git url and using passport-forge-oauth2
in place of passport-oauth2
seemed to just work. It looks like you wanted to clean some stuff up or fetch the profile internally before release though? Let me know if there's anything I can help with, I'd be happy to open a PR.
Oh cool, to be honest with you I haven't touch this project in the last 8 months or so, It will probably feel like a new one again :), If you are offering a PR, please go ahead, so We can start moving forward. Once again sorry for not maintaining it, but I've been quite busy in the last months.
This project doesn't appear to be published on npm despite telling users to install via npm in the README. If I run what's written in the README:
I get a 404 error with
'passport-forge-oauth2' is not in the npm registry.
. I couldn't find it under any similar names with a quick search.I think a simple
npm publish
will fix this! Everything else looked good to me.