Authentication has been assigned to a new class, progress.data.AuthenticationProvider. This is to reduce the load on the JSDOSession object. Now, the JSDOSession only handles server data, while the AuthenticationProvider class takes care of client authentication.

To make use of this separation of concerns, you must create a JSDOSession object using the standalone function, getSession( ), and not login( ). Upon execution, getSession( ) performs the following actions:
  • Creates an AuthenticationProvider object (of the progress.data.AuthenticationProvider class), which takes care of authenticating the user with the backend server
  • Creates a JSDOSession object with the AuthenticationProvider object
  • Executes the addCatalog( ) method to load one or more Data Service Catalogs to the JSDOSession object
Once getSession( ) is successfully executed, JSDO objects can be created.
getSession( ) – Sample Code
let session;
// Create a JSDOSession that is authenticated and has added a catalog via getSession()
progress.data.getSession({
    serviceURI: 'http://oemobiledemo.progress.com/OEMobileDemoServicesBasic/',
    catalogURI: 'http://oemobiledemo.progress.com/OEMobileDemoServicesBasic/static/CustomerService.json',
    authenticationModel: progress.data.Session.AUTH_TYPE_BASIC,
    username: user,
    password: pw
}).then((object) => {
    let jsdo;
    // We can verify that the JSDOSession is authorized by checking the
    // connected property
    console.log("JSDOSession status: " + object.jsdosession.connected);
    // Create a new JSDO now that we've got a session going
    jsdo =  new progress.data.JSDO("Customer");
    // Request data from the backend with a filter
    return jsdo.fill("CustNum < 11");
}).then((object) => {
    // We can verify that we succeeded because of the jsdo.success flag
    console.log("JSDO fill status: " + object.jsdo.success);
    // Print out the CustNum's and names of the object
    object.jsdo.ttCustomer.foreach((customer) => {
        console.log(customer.data.Custnum + ": " + customer.data.Name);
    });
});
To terminate a JSDOSession, use the invalidate( ) method instead of the logout( ) method. The logout( ) method logs the user out of the session but retains some data in memory. The invalidate( ) method not only terminates the user’s login session but also correctly removes all its data from memory as well as prevents the JSDOSession from being reused.
invalidate( ) – Sample Code
// Since we're done, we can clean up the JSDOSession via invalidate()
    session.invalidate().then((object) => {
    // We can verify that the JSDOSession is no longer valid via the connected flag
    console.log("JSDOSession status: " + object.jsdosession.connected);
});