Passport strategy for authenticating with Emploi Store , a platform setup by Pôle Emploi, the French unemployment agency, to share the public data.
This module lets you authenticate using Emploi Store in your Node.js applications. By plugging into Passport, Pôle emploi authentication can be easily and unobtrusively integrated into any application or framework that supports Connect-style middleware, including Express.
$ npm install passport-emploi-store
The Emploi Store authentication strategy authenticates users using a Emploi Store account,
which is also an OpenID 2.0 identifier. The strategy requires a validate
callback, which accepts this identifier and calls done
providing a user.
Additionally, options can be supplied to specify a callback URL and realm.
passport.use(new EmploiStoreStrategy({
clientID: "your_client_id",
clientSecret: "your_client_secretToken",
callbackURL: "http://localhost:3000/auth/emploi-store/callback",
userProfileURI: "https://api.emploi-store.fr/partenaire/peconnect-individu/v1/userinfo",
authorizationURL: "https://authentification-candidat.pole-emploi.fr/connexion/oauth2/authorize",
tokenURL: "https://authentification-candidat.pole-emploi.fr/connexion/oauth2/access_token",
realm: "/individu",
responseType: "code",
scope: ['openid','profile','email', 'api_peconnect-individuv1']
// optional nonce: nonce
},
function(accessToken, refreshToken, profile, done) {
return done(err, profile);
}));
Use passport.authenticate()
, specifying the 'emploi-store'
strategy, to
authenticate requests.
For example, as route middleware in an Express application:
app.get('/auth/emploistore',
passport.authenticate('emploi-store'));
app.get('/auth/emploistore/callback',
passport.authenticate('emploi-store', { failureRedirect: '/login' }),
function(req, res) {
// Successful authentication, redirect home.
res.redirect('/');
});
For a complete, working example, refer to the signon example.
$ npm install --dev
$ make test
This library doesn't provide direct access to the data. To use it, you need to get a client ID and client secret from Emploi Store Dev.
As documented on their website you need to:
- Sign-in or create a new account
- Go to your dashboard
- Add an application, check
Oui
to the questionUtilisation de l’API Pôle emploi
and agree to the terms of use - The client ID and secret are then available as
Identifiant client
andClé secrète
Maintener : Interactive Object https://interactive-object.com/