UiPath / orchestrator-powershell

UiPath Orchestrator PowerShell cmdlet library
MIT License
108 stars 56 forks source link

Authtoken with windows credential failing: Unauthorized #6

Closed ekalkst closed 5 years ago

ekalkst commented 6 years ago

Used get-uipathauthtoken with -WindowsCredetnials and -Session in parameters. Get a response but the next call will fail

uipathps

rusanu commented 6 years ago

The Windows based authorization creates a token that is not actually validating the credential. This makes it confusing for an user that receives a successful token, only to fail when using it.

DRCawthon commented 6 years ago

Getting the same thing. Any ETA on a solution? image

rusanu commented 6 years ago

@DRCawthon let me make sure I understand: you are getting a Windows Authentication token, and at the first use you are getting an authentication error?

DRCawthon commented 6 years ago

Yes correct. In my first screenshot you can see that i put the token into a variable but the actual token field is empty. Whenever i try to use it to upload a package i get the error you see in the 2nd screenshot that Im not authorized.

rusanu commented 6 years ago

This issue here is simply about the problem that Get-UiPathAuthToken should fail if the user is not authorized, not return a success token that fails when tried to be used.

But in your case, It looks like that you are not authorized. Are you trying to debug/troubleshoot why are you not authorized?

DRCawthon commented 6 years ago

I should be authorized. Im an Admin in the Orchestrator instance. Even if I try to use username and password of admin account (i installed Orchestrator) i get the same null token.

Michel001 commented 6 years ago

i have the same problem at DRCAwthon. When i use the admin account created at install Get-UiPathAuthToken -URL https://domain -Username admin -Password password -Session -verbose i get a token but when i do Get-UiPathAuthToken -URL https://domain -WindowsCredentials -Session -verbose i get no token but no errors either i get the same as the above pictures. the powershell user is at that moment also an administrator on the Orchestrator instance.

edit. when i use the AD user with the admin /password link. i get this

VERBOSE: Microsoft.Rest.HttpOperationException: Operation returned an invalid status code 'BadRequest' at UiPath.Web.Client.Account.d5.MoveNext() in C:\git\orchestrator-powershell\UiPath.Web.Client\generated\Account.cs:line 83 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at UiPath.Web.Client.AccountExtensions.d1.MoveNext() in C:\git\orchestrator-powershell\UiPath.Web.Client\generated\AccountExtensions.cs:line 52 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at UiPath.Web.Client.AccountExtensions.Authenticate(IAccount operations, LoginModel loginModel) in C:\git\orchestrator-powershell\UiPath.Web.Client\generated\AccountExtensions.cs:line 32 at UiPath.PowerShell.Util.UiPathCmdlet.HandleHttpOperationException[T](Func`1 action) in C:\git\orchestrator-powershell\UiPath.PowerShell\Util\UiPathCmdlet.cs:line 25 at UiPath.PowerShell.Cmdlets.GetAuthToken.GetUserToken() in C:\git\orchestrator-powershell\UiPath.PowerShell\Cmdlets\GetAuthToken.cs:line 162 at UiPath.PowerShell.Cmdlets.GetAuthToken.ProcessRecord() in C:\git\orchestrator-powershell\UiPath.PowerShell\Cmdlets\GetAuthToken.cs:line 75

nlmaca commented 6 years ago

Is there any news on this? im experiencing the same problem.

rusanu commented 5 years ago

Resolving this since does not reflect a problem with the library and is non-actionable. All cases I looked are were incorrect assumptions (Azure AD vs. AD), legit authentication issues (user had no access) or old Orchestrator deployments (18.1 with OU enabled does not work with AD auth for API calls)