mirror of
				https://github.com/strapi/strapi.git
				synced 2025-10-30 17:37:26 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			20 lines
		
	
	
		
			408 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			408 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| 'use strict';
 | |
| 
 | |
| /**
 | |
|  * Jwt.js service
 | |
|  *
 | |
|  * @description: A set of functions similar to controller's actions to avoid code duplication.
 | |
|  */
 | |
| 
 | |
| const _ = require('lodash');
 | |
| const jwt = require('jsonwebtoken');
 | |
| 
 | |
| module.exports = {
 | |
|   issue: (payload) => {
 | |
|     return jwt.sign(
 | |
|       _.clone(payload.toJSON()),
 | |
|       process.env.JWT_SECRET || _.get(strapi, 'api.user.config.jwtSecret') || 'oursecret'
 | |
|     );
 | |
|   }
 | |
| };
 | 
