backend/helpers/SessionManager.js
/***
     * Initializes the session manager.
     *
     * Registers the jwt plugin and configures the auth strategy
     *
     * @param server
     */
Initializes the session manager.
Registers the jwt plugin and configures the auth strategy

@param server
Initializes the session manager . Registers the jwt plugin and configures the auth strategy @param server
init(server) {
        server.register(require('hapi-auth-jwt2'), (err) => {
            if (err) {
                console.log(err);
                return;
            }
            server.auth.strategy('jwt', 'jwt',
                { key: process.env.JWT_SECRET, 
                    validateFunc: this.validate.bind(this), 
                    verifyOptions: { algorithms: [ 'HS256' ] } 
                });
            server.auth.default('jwt');
        });
    }
init ( server ) { server . register ( require ( 'hapi-auth-jwt2' ) , ( err ) => { if ( err ) { console . log ( err ) ; return ; } server . auth . strategy ( 'jwt' , 'jwt' , { key : process . env . JWT_SECRET , validateFunc : this . validate . bind ( this ) , verifyOptions : { algorithms : [ 'HS256' ] } } ) ; server . auth . default ( 'jwt' ) ; } ) ; }
Initializes the session manager.
Initializes the session manager .
// Never Share your secret key // validate function defined above // pick a strong algorithm