checkToken
This commit is contained in:
		
							parent
							
								
									7e76a787c9
								
							
						
					
					
						commit
						9b3209efd5
					
				
							
								
								
									
										13
									
								
								src/checkToken.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								src/checkToken.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,13 @@ | ||||
| import { JWTOptions } from "./Constants"; | ||||
| import jwt from "jsonwebtoken"; | ||||
| import Config from "./Config"; | ||||
| 
 | ||||
| export function checkToken(token: string) { | ||||
| 	return new Promise((res, rej) => { | ||||
| 		jwt.verify(token, Config.getAll().api.security.jwtSecret, JWTOptions, (err, decoded: any) => { | ||||
| 			if (err || !decoded) return rej("Invalid Token"); | ||||
| 
 | ||||
| 			return res(decoded); | ||||
| 		}); | ||||
| 	}); | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Flam3rboy
						Flam3rboy