Posted on 02-13-2015 04:21 AM
Hello there,
While trying to develop a script using the API, I was doing some tests with the web access to it. And it kept telling me I was not authorised even if I used the first JSS account created that could, of course, perfectly access the JSS. I tried another account with full admin privileges and it was the same.
I've been searching for a few hours until I realised what was wrong, my passwords. Both used a special character, the "%". When I changed the password to another one without this specific character, it worked perfectly.
So, it seems that it's a bad idea, which makes sense as this character is used to encode special characters in URLs but I just wanted to mention it here.
FWIW, I tried to escape this character in my curl command but it failed to, but I haven't tried hard or searched among the gazillions options of curl to make sure I did it correctly.
Posted on 02-13-2015 05:54 AM
Hi @Pertois (long time no see BTW, haven't seen you since Cannes!).
Just out of interest, is it the same when you use ' ' to encapsulate the PW? I always avoid @£# symbols incase someone's using a PC keyboard but % is pretty popular.
Posted on 02-13-2015 06:34 AM
Hi @davidacland (yeah, that's right, long time, hope to see you soon),
Yep, I've tried that too and no luck, at least with curl. Same for us, % is pretty popular here :-/
Posted on 02-13-2015 12:49 PM
@Pertois][/url I had the same issue once before, if you single quote(') out a string, it doesn't fully see it as one single line. Try the following:
password='blahblahblah'
when you call the variable do the following:
${password}
This should take care of the special symbol.
Posted on 02-14-2015 03:31 AM
Hi @GaToRAiD,
Thanks for the trick but it didn't work either, at least with this :
#!/bin/sh
password='lolo%'
curl -k -v -u lolopb:${passwordj} https://jss.mycompany.com:8443/JSSResource/accounts
I have to mention also that it doesn't work either in a GUI browser.
Posted on 02-14-2015 03:50 AM
I'm guessing the extra j when you call the variable isn't the problem ;)
It does sound like it's just an unsupported character as you said. Could be worth putting the question to JAMF support when you're next speaking to them.
Posted on 02-14-2015 05:54 AM
Yes, @davidacland, you guess right, I had used the passwordj in my test script and I didn't copy the variable when preparing my answer here, I totally forgot to write the j :)
That's my plan, in fact I wanted to share this here for others who could hit the same wall one day.