json authentication

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
pajito
Posts: 30
Joined: Thu Apr 13, 2017 8:08 pm

json authentication

Post by pajito » Mon Nov 07, 2022 10:34 pm

Hi there,

I am trying to populate a widget via an online json file. I managed to do so when I used an "open" online json file, the problem comes when the official data I have to use has an authentication key. There is also a basic authentication with username and password, which also I can not figure out, but I was instructed to use the authentication key.

Any ideas?

thanks in advance
pajito

stam
Posts: 3072
Joined: Sun Jun 04, 2006 9:39 pm

Re: json authentication

Post by stam » Mon Nov 07, 2022 11:18 pm

Hi Pajito,

do you mean you're trying to log in with an online API that accepts and returns JSON?
I suspect you need to set the data in httpHeaders - if that's the case you should search the forum and the Dictionary for examples - there are a few in the forums.

If it's something else, can you clarify?

HTH
Stam

pajito
Posts: 30
Joined: Thu Apr 13, 2017 8:08 pm

Re: json authentication

Post by pajito » Mon Nov 07, 2022 11:27 pm

Hi and thanks for the reply,

yes i tried this approach but it didn't return any results. propably I use it wrong or something

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10045
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: json authentication

Post by FourthWorld » Tue Nov 08, 2022 12:32 am

pajito wrote:
Mon Nov 07, 2022 10:34 pm
the problem comes when the official data I have to use has an authentication key. There is also a basic authentication with username and password, which also I can not figure out, but I was instructed to use the authentication key.
What are the instructions for using the authentication key?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

pajito
Posts: 30
Joined: Thu Apr 13, 2017 8:08 pm

Re: json authentication

Post by pajito » Tue Nov 08, 2022 12:50 am

[/quote]
What are the instructions for using the authentication key?
[/quote]

hi, they just gave me a link which I can share

Code: Select all

https://www.myrace.gr/json/leaderboard?id=2146&m=5148
and an authentication key. There is a basic authentication mode but still doesn't seem to work

thanks

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10045
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: json authentication

Post by FourthWorld » Tue Nov 08, 2022 3:12 am

Did they provide any instructions on what you're expected to do with the authentication key? Does it go in the headers? Does it become a URL parameter? Any instructions at all?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

pajito
Posts: 30
Joined: Thu Apr 13, 2017 8:08 pm

Re: json authentication

Post by pajito » Tue Nov 08, 2022 7:22 am

FourthWorld wrote:
Tue Nov 08, 2022 3:12 am
Did they provide any instructions on what you're expected to do with the authentication key? Does it go in the headers? Does it become a URL parameter? Any instructions at all?
Hi, yes the authentication goes to the headers. Bellow you can find the code I used with batch file and managed to data

Code: Select all

curl -H "authorization:abcdefgh" "https://www.myrace.gr/json/leaderboard?id=2146&m=5148"  
Obviously the authentication key is not that,but I can share in a DM

Thank you

pajito
Posts: 30
Joined: Thu Apr 13, 2017 8:08 pm

Re: json authentication

Post by pajito » Tue Nov 08, 2022 9:32 am

FourthWorld wrote:
Tue Nov 08, 2022 3:12 am
Did they provide any instructions on what you're expected to do with the authentication key? Does it go in the headers? Does it become a URL parameter? Any instructions at all?

Also I was given the option of basic authentication as the administrator called it , which has a username and a password

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10045
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: json authentication

Post by FourthWorld » Fri Nov 11, 2022 2:45 am

Have you used Basic Auth before?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply