Web authentication question

So I found myself with a few spare minutes this week, so I decided to try to use Panorama X to solve the puzzles in this year’s Advent of Code challenge. Basically, it’s a new puzzle each day that one solves by coding something up to compute a result from some initial data provided on a web page.

I know how to grab the data I need from a web page, the problem is that every user gets unique data (and must be logged in to get it), so when i send Panorama to that page to slurp up the data, it fails because the panorama request is seen as a new session. i could make a browser object and log in that way, but i’d prefer to just hardcode my credentials into a Panorama procedure and use it to grab the data, authenticating as necessary. (it’s not really a high security situation-I get that this is generally regarded a terrible practice.) I’m pretty good at Panorama coding but i am woefully ignorant of most HTML. I know this can be done in Panorama - can anyone point me in the right direction to figure this out?

This is what the authentication page looks like:
https://adventofcode.com/2023

I’m happy to do most of the figuring out- I just need somewhere to start…

I feel like i’ve seen this answer before, i just can’t find it :frowning:

cw

PS
This little coding challenge is a fantastic way to refresh one’s Panorama skills- and so far the problems are fun, and not too easy. For example, day one had us finding the first and last digits of strings like this:

two1nine
4nineeightseven2
zoneight234
7pqrstsixteen

the catch… is that numbers expressed as words count, too. And to complicate matters, entries like the third one above translate to “18234”-- the string contains “one” and “eight”, but they overlap! This stumped me for a minute. My solution was a total hack, but it worked :slight_smile:

If you’re a geeky scrooge like me, it’s like procrastination with benefits :slight_smile:

I want to know the name of the law that says “previously invisible search results only appear after one has asked the same question in a public forum”

I haven’t tested it yet but it looks like

url("http://www.somesite/securepage","USER","johnsmith:secret")

is what I’m looking for.

Bah humbug! :slight_smile:

You didn’t write back, so maybe your last post was the solution you were looking for. But I kind of doubt it. That solution will work for web sites that do there own authentication thru HTTP protocol. However, not many web sites use that system these days, and it sounds like advent of code does not - here is what their FAQ page says.

If you are still stuck, what you might try is making a form with a web browser object, and using that browser to log into Advent of Code. I assume that will set up cookies that store the login information. Then when you use the url( function, it will share the same cookies with the web browser object, so you will be able to access the pages you want.

If that doesn’t work - I’m stumped. For example, if a web page used JavaScript as part of their authentication, I don’t think you would be able to access it via the url( function, since there is no way to run JavaScript as part of a url( request.

Hmm, apparently there is a JSON API for Advent of Code. I couldn’t find the main documentation page for it, but here is somewhere you can start in your research. Since Panorama X supports JSON, it should be possible to use this API.

https://www.reddit.com/r/adventofcode/wiki/faqs/automation/

Wow thank you.

I hadn’t seen that page, but i eventually took the ‘manual download & cache it’ approach and coded accordingly .

I do VERY little coding outside Panorama- a little javascript hacking now and then, and I used to write stuff in Pascal a million years ago. Perhaps the most interesting thing about the Advent of Code exercises is how similar the problems are (so far, anyway) to the real world issues I encounter when using Panorama… …and I find myself feeling really grateful that so many of the really basic needs (file saves and reads, sorting, persistence, the list goes on) are covered at a nice high level by Panorama (and MacOS) so i don’t need to worry about them.

2 Likes

Ain’t that the truth!

1 Like