Unable to authenticate Orchestrator API for accessing Bearer Token. Invalid credentials error for valid credentials entered

License type(Free, Trial/License code): Community Edition
Studio/Robot version: 2019.6.0

Screenshot: {
“message”: “{“message”:“Invalid credentials, failed to login.”,“errorCode”:1000,“resourceIds”:null}”,
“level”: “Information”,

Endpoint used: https://platform.uipath.com/api/account/authenticate

Hi @sherinaiju,
Welcome to the Community!
Please have a look here:
https://orchestrator.uipath.com/v2019-fastTrack/reference#about-odata-and-references

1 Like

Hi @sherinaiju

See also this post for more reference:

I just registed a account for consuming api. However I still get the same authentication error. I’ve checked my request using my friend’s account without any problem. I believe there’s some bug in the authentication process. Can you create a new account and try using for API authentication?

Hi @brian91

Could you let us know what steps have you taken so far?

It should be as easy as running the project I made (see list to the post attached above). It will generate all the tokens.

It would help if you could show us the parameters of your API call and the error you are getting :slight_smile:

@loginerror

Can you please help me on this

1 Like

Hello, i have the same problem.
The request and the response:


I don’t understand the problem.

Can you please help me?

Hi @Robot1

Welcome to our UiPath Forum :slight_smile:

For our free Cloud Orchestrator instance, please see the documentation here:
https://docs.uipath.com/orchestrator/v2019/reference#consuming-cloud-api

As well as links posted above in this topic.

It is no longer possible to authenticate with your basic tenant/username/password method. This is why you are getting the error.

1 Like

Thank you for the help.

1 Like

Hi All,

Even after following this link:

https://docs.uipath.com/orchestrator/reference#consuming-cloud-api

Whenever I m trying to add a record into the Queue using the same Post method mentioned in same page.

Its not working it says: You are not authenticated, even passing the Authorization code as well as X-PATH Service name as mentioned on last line of the same page.

Important!

All Orchestrator API calls subsequent to the initial authorization have to contain the following headers:

Authorization: Bearer [access_token]
X-UIPATH-TenantName: [service_instance_logical_name]

Please help as its stopping the whole code for us.

Thanks a lot in advance

Hi @Anil_choudhary

Could you check out this blog post and see if it will be helpful? :slight_smile:
http://dealetech.com/the-definitive-guide-to-uipath-cloud-orchestrator-2019-09-rest-api-authentication/#dev

This user has put a lot of effort into explaining his journey with our Cloud Platform Orchestrator API and his blog might be of help here.

2 Likes

@loginerror

One issue which I feel the reason for this error is the Azure site link or where the community edition orchestrator is hosted.

if the service URL is this when you try to get the data for ServiceName and other things:
https://crpa-prod-orch0-ne-webapp.azurewebsites.net

If you see the service URL as
https://platform-community.azurewebsites.net/

Because, when you paste the first link in URL and try to login with your correct credentials also, it will always throws an exception of wrong credentials.

Where as in the below link: it will allow you to login to your account with any issue, you just need the Tenant Name and user credentials.

Hope this is the only or main issue of Authentication failure while entering data into the Orchestrator Queues.

Thanks

1 Like

I m able to reach upto set4.
Step 5 when i m trying to enter data into the queue.
I m getting status as 200 and response as HTML code and not what is mentioned in the document as well as its not adding any item to the mentioned queue.

Trying with a new machine again from starting, let me check what i missed.

will keep you posted for the same.

Thanks

new update:

The account is community edition account and userid and password are used to login to platform.uipath.com

Everything till step 4 of the document works fine. only issue is when enterting data into the queues code.

whenever I request for the serviceInstancename request using get method,
I m getting these values:

My service Instance name is correct,

“serviceInstanceName”: “NewServiceForTesting”,
“serviceInstanceLogicalName”: “NewServiceFl16p244955”,
“serviceType”: “ORCHESTRATOR”,
“serviceUrl”: “https://crpa-prod-orch0-ne-webapp.azurewebsites.net”,
“serviceState”: “ENABLED”,
“userRolesInService”: [
“Administrator”

But i need to pass the serviceInstanceLogicalName in the post request for inserting the data into the Queue.

And whenever i execute this POST method,

https://platform.uipath.com/finalservice/NewServiceFl16p244955/odata/Queues/UiPathODataSvc.AddQueueItem

it gives an error saying you are not authenticated.

“message”: “You are not authenticated!”,
“errorCode”: 0,
“result”: null,
“targetUrl”: null,
“success”: false,
“error”: {
“code”: 0,
“message”: “You are not authenticated!”,
“details”: “You should be authenticated (sign in) in order to perform this operation.”,
“validationErrors”: null
},
“unAuthorizedRequest”: false,
“__abp”: true

Could you maybe show your postman input?

As far as the URL, you should use this one at all times:
https://platform.uipath.com/accountLogicalName/serviceInstanceLogicalName

1 Like

All, Sorry, I have been out of town for a few days and not responding.

@Anil_choudhary,

You need 4 headers in API Requests:

I see you mention Authorization and Tenant in your comment above, but not

X-UIPATH-DefaultFolder
and Content-Type.

If you have not created folders or done anything to move resources, then your “stuff” is in the Default folder.

X-UIPATH-DefaultFolder: “Default” would be the header.

Without the Folder header you get a “You are not Authenticated” response.

@loginerror,

I think you have a typo in your URL ^^^^^ . The first substitution is the Account_logial_name

1 Like

Hi @loginerror,

till yesterday this link was working fine but from today, I m not able to run this nodejs code also.

Not sure as i m following the Deale Tech document only and wanted to try it again with this information you had shared.

Could you maybe show your postman input?

As far as the URL, you should use this one at all times:
https://platform.uipath.com/ serviceInstanceName / serviceInstanceLogicalName

Hope the nodejs code is not wrong, because it worked till yesterday.

thanks

Could you try adding

var crypto = require('crypto');

at the begging of the code, like so:

var crypto = require('crypto');
function base64URLEncode(str) {
  return str.toString('base64')
    .replace(/\+/g, '-')
    .replace(/\//g, '_')
    .replace(/=/g, '');
}
 
function sha256(buffer) {
  return crypto.createHash('sha256').update(buffer).digest();
}
 
console.log("Generating challenge and Verifier");
var cryptoResult = crypto.randomBytes(32);
var verifier = base64URLEncode(cryptoResult);
var challenge = base64URLEncode(sha256(verifier));
console.log("Code challenge: " + challenge)
console.log("Code verifier: " + verifier);

Sorry. Cut and paste error in the Blog post. It is fixed now.

LoginError is 100% correct. crypto needed to be required before it was used.

– M

Actually, it was working without it untill recently. It was like that in the docs as well but it is now fixed.