authentication failed
I am using pfsense version 2.7.0
My credentials.sample.ini [PFFApmZct0c2GNW6AC5spIFs] secret = hwcf7405cGl3WZmsUWwi1KohbI3XDHZZhhnEIXzXLOygsxK8n45ts7Owbex3 permit = alias_, config_, gateway_, rule_, send_, system_, function_* comment = example key PFFApmZct0c2GNW6AC5spIFs - hardcoded to be inoperative
I am using typescript fauxapi-client
import {FauxApiClient, IFauxApiResponse} from 'faux-api-client';
const fauxApiClient = new FauxApiClient( '192.168.0.100', 'PFFApmZct0c2GNW6AC5spIFs', 'hwcf7405cGl3WZmsUWwi1KohbI3XDHZZhhnEIXzXLOygsxK8n45ts7Owbex3' );
fauxApiClient.getConfiguration() .then((success: IFauxApiResponse) => { console.log('#################################################'); console.log('# SUCCESS #'); console.log('#################################################'); console.log(JSON.stringify(success)); }) .catch((error: Error) => { console.log('#################################################'); console.log('# ERROR #'); console.log('#################################################'); console.log(JSON.stringify(error)); });
Error : -
#################################################
ERROR
################################################# {"name":"StatusCodeError","statusCode":401,"message":"401 - {"callid":"66382edddeb73","message":"authentication failed"}","error":{"callid":"66382edddeb73","message":"authentication failed"},"options":{"headers":{"Content-Type":"application/json","fauxapi-auth":"PFFApmZct0c2GNW6AC5spIFs:20240505Z201348:6dfd4502:7465c9d52c98ef93312b77893466c4d050fb8b35bb763750cc781481ac71bfb0"},"json":true,"rejectUnauthorized":false,"uri":"https://192.168.0.100/fauxapi/v1/?action=system_stats","method":"GET","simple":true,"resolveWithFullResponse":false,"transform2xxOnly":false},"response":{"statusCode":401,"body":{"callid":"66382edddeb73","message":"authentication failed"},"headers":{"server":"nginx","date":"Mon, 06 May 2024 01:14:05 GMT","content-type":"application/json","transfer-encoding":"chunked","connection":"close"},"request":{"uri":{"protocol":"https:","slashes":true,"auth":null,"host":"192.168.0.100","port":443,"hostname":"192.168.0.100","hash":null,"search":"?action=system_stats","query":"action=system_stats","pathname":"/fauxapi/v1/","path":"/fauxapi/v1/?action=system_stats","href":"https://192.168.0.100/fauxapi/v1/?action=system_stats"},"method":"GET","headers":{"Content-Type":"application/json","fauxapi-auth":"PFFApmZct0c2GNW6AC5spIFs:20240505Z201348:6dfd4502:7465c9d52c98ef93312b77893466c4d050fb8b35bb763750cc781481ac71bfb0","accept":"application/json"}}}} StatusCodeError: 401 - {"callid":"66382edddeb73","message":"authentication failed"}
credentials ini file
tsfile:-
Error:-
Try enabling request debug to get more information, you can enable debug per request by adding __debug=true request parameter
See debug docs here -
- https://github.com/ndejong/pfsense_fauxapi?tab=readme-ov-file#debugging
Onec you have more information please post back here
In /var/log/system.log file it shows this error:-
In webGui systemlogs :-
The logs are telling you that you don't have the file /etc/fauxapi/credentials.ini
Perhaps you edited the file credentials.sample.ini and did not renam it to credentials.ini
The error is resolved my credentails file was already named as credentials.sample.ini after i renamed it to credentials.ini the issue has been resolved . Thanks for your support sir :)