Auth-simple.js seem no function

From the auth-sample.js,the content as follow:

“use strict”;

function connectionRequest(deviceId, url, username, password, callback) {
return callback(username || deviceId, password || “”);
}

exports.connectionRequest = connectionRequest;

I create a new auth.js file use this content,but it’s no function,
when I use the content as follow:
“use strict”;

function connectionRequest(deviceId, url, username, password, callback) {
return callback(‘someUsername’, ‘somePassword’);
}

exports.connectionRequest = connectionRequest;

In my CPE,I input request username and password from the script , it work normal,
but I want to use dynamic username and password in CPE, so that acs can control CPE .
Have someone to help me? or need more information for this

I’m not sure I understand the question. From what you’re describing the script seems to be working as intended.

@zaidka
when I use this auth.js,

function connectionRequest(deviceId, url, username, password, callback) {
return callback(‘someUsername’, ‘somePassword’);
}

exports.connectionRequest = connectionRequest;

/////
and I configure ‘someUsername’, ‘somePassword’ in CPE configuration,it work normal,

but when I use this auth.js:

“use strict”;

function connectionRequest(deviceId, url, username, password, callback) {
return callback(username || deviceId, password || “”);
}

exports.connectionRequest = connectionRequest;

//////
it is not work,when I input ‘someUsername’, ‘somePassword’ in CPE configuration

The arguments ‘username’ and ‘password’ have the values of the ‘ConnectionRequestUsername’ and ‘ConnectionRequestPassword’ params as they exist in the database. You’ll want to create a preset to ensure those parameters are set.

@zaidka,yes I think that create a preset is my need,but I don’t know how to create it
.
image
I think it too complex for me.please provide a example.

Ok,I will study it,thank you for your help@zaidka

@zaidka
I still don’t find how to set ‘ConnectionRequestUsername’ and ‘ConnectionRequestPassword’ params in preset

@zzz
here is the preset

and here is the provision, which is executed by preset

const now = Date.now();

log('Set Connection Request params');
declare("InternetGatewayDevice.ManagementServer", {value: now});
declare("InternetGatewayDevice.ManagementServer.ConnectionRequestUsername", {value: now}, {value: "acs"});
declare("InternetGatewayDevice.ManagementServer.ConnectionRequestPassword", {value: now}, {value: "acs"});

@jozefrebjak
thank you I will try tomorrow