keithjgrant / omnibear

A Micropub browser extension
MIT License
36 stars 8 forks source link

Discover endpoints using Link header #41

Closed valpackett closed 6 years ago

valpackett commented 6 years ago

Hi! Tried the extension, got this:

Missing micropub data on https://unrelenting.technology/. Please ensure the following links are present: authorization_endpoint, token_endpoint, micropub

with this header:

Link: <https://unrelenting.technology/webmention>; rel=webmention, <https://unrelenting.technology/micropub>; rel=micropub, <https://unrelenting.technology/login>; rel="token_endpoint", <https://indieauth.com/auth>; rel="authorization_endpoint", <https://switchboard.p3k.io>; rel=hub, <https://unrelenting.technology/>; rel=self

micropub-helper actually supports Link headers, but it seems you use some server-side app to authenticate (is it open source?)

grantcodes commented 6 years ago

Have you tried compiling omnibear from the source here? GitHub has the updated micropub-helper library but the released version doesn't.

I haven't really fully tested the micropub-helper header handling but I think it should work

valpackett commented 6 years ago

Oh. It's broken there. It requires the rel to be quoted. I'll send a fix to micropub-helper.

valpackett commented 6 years ago

https://github.com/grantcodes/micropub/pull/5 — that works, but now I'm at this super helpful screen :)

Error fetching token from token endpoint object Object

Looks like I'll need to update my token endpoint to return JSON.

grantcodes commented 6 years ago

Again the token fetching should be handled by micropub-helper and it should support json and querystrings. What does your endpoint return?

valpackett commented 6 years ago

It returned a 406 error because Omnibear sent Accept: application/json

grantcodes commented 6 years ago

Ah ok that is actually from here: https://github.com/grantcodes/micropub/blob/05541c028e218e46529eac7e4ff947c720553bfa/src/main.js#L168

valpackett commented 6 years ago

Yeah, looks like you do parse querystrings, so it should be application/json, application/x-www-form-urlencoded

grantcodes commented 6 years ago

Yeah, if you could test it that would be great and I'll push an update

valpackett commented 6 years ago

It works!

grantcodes commented 6 years ago

Sweet! I'll update all those accept headers and push another micropub-helper update