Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting micropub working #5

Open
bmann opened this issue Sep 28, 2018 · 9 comments
Open

Getting micropub working #5

bmann opened this issue Sep 28, 2018 · 9 comments

Comments

@bmann
Copy link
Owner

bmann commented Sep 28, 2018

Alright, here are some rough notes on getting https://github.com/voxpelli/webpage-micropub-to-github working with my blog, which is live at https://blog.bmannconsulting.com

I used the deploy to Heroku button, got it running right away.

There were a bunch of things I needed to add to my site to work with this stuff. First, there's this:

<link rel="micropub" href="https://example.com/micropub/main">
<link rel="token_endpoint" href="https://tokens.indieauth.com/token">

Instead of example.com, that's bmcblog-micropub.herokuapp.com.

For the indieauth steps you're going to have to do, you'll need to add at least one auth provider. For me, Github was the only one that worked. So, you need to edit your Github profile so that the link in your profile links to your blog. Then you'll need to add somewhere on your web page (doesn't have to be visible), the following:

A visible link: <a href="https://github.com/bmann" rel="me">

Or header link: <link href="https://github.com/bmann" rel="me" />

As said elsewhere, trying to get Instagram posting to your own site is super useful and will walk you through the whole process:

You'll also want to use IndieAuth, so one more custom header:

<link rel="authorization_endpoint" href="https://indieauth.com/auth">

At this point, I got through OWG, authenticated with my Github account (the only one that still seems to work).

I'm getting an error:

HTTP/1.1 100 Continue

HTTP/1.1 400 Bad Request
Server: Cowboy
Connection: keep-alive
Content-Type: text/plain; charset=utf-8
Content-Length: 11
Etag: W/"b-EFiDB1U+dmqzx9Mo2UjcZ1SJPO8"
Date: Fri, 28 Sep 2018 05:51:27 GMT
Via: 1.1 vegur

Bad Request

Now that I had indieauth working correctly, I discovered that https://micropublish.net/ is something else I could sign into with my blog (again, using Github auth).

I can see from Heroku logs that, signed in with IndieAuth to my blog.bmannconsulting.com, it is reading the micropub endpoint and passing it on to the server.

Github is giving an error, which is almost certainly about the wrong path.

Success! https://github.com/bmann/bmcblog/commit/b0c1a44830850498b63eb130ea2fd77f97258a88 (which is private, but trust me!)

OK, so figured it out -- the MICROPUB_SITE_GITHUB_REPO value needs to be just nameOfYourRepo -- e.g. if your username is bmann, then not bmann/nameOfYourRepo.

@bmann
Copy link
Owner Author

bmann commented Sep 28, 2018

Changing MICROPUB_LAYOUT_NAME to be single which is what I use.

MICROPUB_OPTION_DERIVE_CATEGORY I'm going to set to "Micro"

MICROPUB_MEDIA_FILES_STYLE to images/:year-:month-:slug/:filesslug

@bmann
Copy link
Owner Author

bmann commented Sep 28, 2018

OK. Adding those causes it to crash. Now downloading a local copy to investigate env entry crashing.

@bmann
Copy link
Owner Author

bmann commented Sep 28, 2018

only this causes a crash locally? MICROPUB_MEDIA_FILES_STYLE="images/:year-:month-:day/:filesslug"

But on Heroku, if you delete the config var, then it crashes on layout name.

OK, let's go into handler.js and hardcode a few things!

OK, it still posts the default "social" category, so I'm not any farther ahead than when I first got it working.

Because of that social category, it makes it into my "main" feed, which does get posted to Twitter -- but also to LinkedIn and Medium! So fixing that category is going to have to happen.

And MicroBlog iOS still doesn't recognize the endpoint.

@bmann
Copy link
Owner Author

bmann commented Sep 28, 2018

I will need to look through voxpelli/webpage-micropub-to-github#28 and voxpelli/node-micropub-express#11 as I'm not going to get any farther without that endpoint.

Likely other issues there worth looking through.

@bmann
Copy link
Owner Author

bmann commented Sep 29, 2018

I ended up just changing the category I treat as micro posts to be called “social” in my jekyll config. I’ll document what different micropub tools end up posting in separate threads.

@rianvdm
Copy link

rianvdm commented Feb 8, 2019

Did you ever get OwnYourGram to work with this endpoint?

@bmann
Copy link
Owner Author

bmann commented Feb 8, 2019

@rianvdm yep, works no problem. Changing variables seems to cause problems so I just used the out of the box settings and changed my layout.

@infominer33
Copy link

idk what I'm doing wrong... likely anything to do with the github access token or (more likely), how I set up the heroku app

{"error":"invalid_request","error_description":"Missing \"Authorization\" header or body parameter."}

@bmann
Copy link
Owner Author

bmann commented May 21, 2019

@infominer33 feel free to open a new issue here with as much detail as possible and I’ll try to help.

The OwnYourGram helped me debug. You need to add a ton of stuff to the HTML of your site. And GitHub identities are the only ones that work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants