Skip to content

Passport strategy for authenticating with Emploi Store , a platform setup by Pôle Emploi, the French unemployment agency, to share the public data.

License

Notifications You must be signed in to change notification settings

younes200/passport-emploi-store

Repository files navigation

Passport-Emploi-Store

Build Status

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.

Install

$ npm install passport-emploi-store

Usage

Configure Strategy

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);
}));

Authenticate Requests

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('/');
  });

Examples

For a complete, working example, refer to the signon example.

Tests

$ npm install --dev
$ make test

API Key

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 question Utilisation de l’API Pôle emploi and agree to the terms of use
  • The client ID and secret are then available as Identifiant client and Clé secrète

Used in

License

The MIT License

Maintener : Interactive Object https://interactive-object.com/

About

Passport strategy for authenticating with Emploi Store , a platform setup by Pôle Emploi, the French unemployment agency, to share the public data.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published