As a proof of concept, I’m making a small API in Golang that, on an Apache with mod_proxy, serves certain content to a WordPress site.
The small challenge, which is really small, is knowing from that mini application in Go, and through the wordpress_logged_in_XXXXXX cookie who the user is (if they’re logged in).
To see how WP composes the cookie, you only need to look at the source code, and this is how it could be solved in Go
Notes:
I don’t check the Expiration value in this example
This code won’t work for me in the project since I’ll change, through a hook in WP, how the cookie is created and validated by adding 2 more elements to the hash method (to give a bit of extra security): The validated user’s IP and the Browser used (Agent), since I consider WP’s default format too “weak”.










Comments