Skip to content

Instantly share code, notes, and snippets.

View kalendar's full-sized avatar

David Wiley kalendar

View GitHub Profile
@kalendar
kalendar / wordpress-wjt-httr.R
Last active July 20, 2019 22:58
Publishing to the Wordpress REST API from R with JSON Web Tokens and httr
library(httr)
# Get the JWT
get_jwt <- POST("https://example.com/throwaway/wp-json/jwt-auth/v1/token",
query = list(username = "your_username", password = "your_password"))
token <- content(get_jwt)$token
# Confirm auth is working
test <- POST("https://example.com/throwaway/wp-json/jwt-auth/v1/token/validate",
add_headers('Authorization' = paste("Bearer", token, sep = " ")), encode = "json")
@kalendar
kalendar / .htaccess
Last active November 9, 2018 20:18
.htaccess for using WJT with Wordpress
# BEGIN WordPress
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]
RewriteEngine On
RewriteBase /throwaway/
...
@kalendar
kalendar / OneName
Created July 24, 2015 18:52
Verifying I am +opencontent on my passcard. https://onename.com/opencontent
Verifying I am +opencontent on my passcard. https://onename.com/opencontent