Orchestrator API - Getting error while Authenticating ("loginModel must not be null")

I am trying to write a Node.js code to call orchestrator API for Authentication. I am getting the below error,
Response: {“message”:“loginModel must not be null”,“errorCode”:0,“resourceIds”:null}
any help is really appreciated.

==============Node.js Code====================
var http = require(‘https’);
exports.handler = function(event, context){

    var params = {
      "tenancyName": "tenantName",
      "usernameOrEmailAddress": "emailId",
      "password": "password"
    };

   var req = http.request({
        host: "platform.uipath.com",
        port: 443,
        path: "/api/account/authenticate",            
        method: "POST",
        dataType: "json",
        headers: {
                    "Content-Type": "application/json",
                    "Accept": "application/json"
                  },
        data: JSON.stringify(params)
    }, function (response) {
        response.on('data', function(data) {
       console.log('Response: ' + data);
   });
   
});
req.setTimeout(5000, function() {
   console.log('Request timed out.');
});
req.on('error', function(ex){
       console.log('Request was a failure. ' + ex.message);
});
req.write('');
req.end();

};

Please check this thread, we’re working on a fix: UiPath Orchestrator APIs not working since Cloud Platform Release - #17 by loginerror

1 Like

Still the same error “loginModel must not be null”.

And you have already tried calling it from a service such as postman, just to check if you actually have a connection?

I am getting same error while hitting the “https://platform.uipath.com/api/account/authenticate” in postman
how should i authenticate???

Running “https://platform.uipath.com/api/Account/Authenticate” in postman and getting the same error
{
“message”: “loginModel must not be null”,
“errorCode”: 0,
“resourceIds”: null
}
Is there any fix for this?

2 Likes

We are trying to connect to on premise Orchestrator API from OSB Middleware and getting this error. We are able to connect using Postman as well as Python script. Any solutions?

I have the same issue, unable to autenticate via Swagger or Postman
Same error:
{
“message”: “loginModel must not be null”,
“errorCode”: 0,
“resourceIds”: null
}

I am working on an On-Premise orchestartor and I can access it just fine.
However, I fail to even authenticate using APIs

1 Like

Hello everyone,

I am facing the same issue, getting back the JSON error:
{
“message”: “loginModel must not be null”,
“errorCode”: 0,
“resourceIds”: null
}

Is this issue fixed?

Thanks,
Jasmin

Hi @Jasmin_Becirevic

I got this solution for UiPath community Orchestrator from UiPath, Well I was not able to authenticate using this method also.
But if you might try now it might work.

Thanks

Hello everyone,

its working, so please ignore my reply “its not working”.

Didn’t know that the tenant param is mandatory.

I got my token back:

{
“result”: “…”,
“targetUrl”: null,
“success”: true,
“error”: null,
“unAuthorizedRequest”: false,
“__abp”: true
}

Thank you,
Jasmij

Hello,

I am following the documentation here: Consuming Cloud API to no avail.

I am setting my headers as in the docs and the body includes those three things:
{
“grant_type”: “refresh_token”,
“client_id”: “8DEv1AMNXczW3y4U15LL3jYf62jK93n5”,
“refresh_token”: “my refresh token value”
}

Sending a POST to https://account.uipath.com/oath/token
I get a response back of 404 Not Found

Please help!

login Model, as described at the bottom of swagger page, refers to tenancy detail, login and password.
image
"loginModel must not be null” means above details are not supplied properly.

Also please refer to below for supported API.
https://docs.uipath.com/orchestrator/reference/authenticating

Swagger provides you a curl format of the same command, please make sure the command you are running is equivalent to the curl command in programming language of use.
https://docs.uipath.com/orchestrator/reference/api-references

Hello Atul,
In this video you have full code in Node.JS that is working (check description):

Thanks,
Cristian Negulescu

1 Like

I was facing the same issue. Just make sure the loginmodel (in your case params variable) should be converted to json if Content-Type is json format.

hi @Yoshi_Akiyama

I am facing “loginModel must not be null” in python code.
Could you please help me to reslove error

@ atul.trikha
@ Viorela PredaUiPath
AndraUiPath
Sandesh_Gaikwad
Anamika15
vaibhav15211

(post deleted by author)

In some cases you may need to escape quotation marks.

So, instead of writing { “tenancyName”: “string”, … }
try { \“tenancyName\”: \“string\”, … }

That fixed the “loginModel must not be null” issue for me when I made requests to the Orchestator API with curl on Windows Command Prompt. If you’re using PowerShell, the same fix works. Though, you may need to do Remove-item alias:curl first, so that curl is used instead of Invoke-WebRequest.