micropub
micropub copied to clipboard
No Authorization from https://micropublish.net/new
I have setup your code. When I try to publish from https://micropublish.net/new I get There was an error making a request to your Micropub endpoint. The error received was: {"error":"no_auth","error_description":"No authorization token supplied."} It authenticates me through indieauth before creating post.
My config
<?php
# We set the default timezone here so that you can safely use the PHP
# date() function inside the config elements below, should you desire.
date_default_timezone_set('America/New_York');
$config = array(
# the URL of our site, with trailing slash.
'base_url' => 'https://denverprophit.us' . $_SERVER['HTTP_HOST'] .'/',
# the base path of the site's docroot, with trailing slash
'base_path' => '/denverpr/public_html/',
# the name of the sub-directory for images, with trailing slash.
# we'll create sub-directories of the form 'year/month/'.
'upload_path' => 'assets/img/',
# the max pixel width of uploaded images.
'max_image_width' => 1920,
# the path to the Jekyll site.
# trailing slash required.
'source_path' => '/denverpr/new/',
# different types of content may have different paths.
# by default, articles are in the root of the /content/ directory, so
# are not included here.
# Notes, reposts, replies, etc are being stored as Jekyll data files
# in the /data directory. No need to prepend "/data" to these paths.
'content_paths' => array(
'bookmark-of' => 'bookmarks',
'in-reply-to' => date('Y/m'),
'like-of' => 'likes',
'note' => date('Y/m'),
'photo' => date('Y/m'),
'repost-of' => date('Y/m'),
'rsvp' => 'rsvp',
),
# I am storing all photos, reposts and replies as notes. So I need a
# way to tell Hugo to use the "note" templates for these items. This
# override controls that.
'content_overrides' => array(
'in-reply-to' => 'right-sidebar',
'photo' => 'right-sidebar',
'repost-of' => 'right-sidebar',
),
# whether or not to copy uploaded files to the source /static/ directory.
'copy_uploads_to_source' => true,
# an external micropub media endpoint to use.
# 'media_endpoint' => 'https://example.com/my-media-endpoint/',
# an array of syndication targets; each of which should contain the
# necessary credentials.
'syndication' => array(
'twitter' => array( 'key' => 'xxx',
'secret' => 'xxx',
'token' => 'xxx',
'token_secret' => 'xxx',
'prefix' => 'I just posted ',
),
),
# some Micropub clients don't set syndication targets for some actions,
# but we may want to syndicate some stuff all the time. For each post
# kind, define an array of mandatory syndication targets.
'always_syndicate' => array(
'repost-of' => array( 'twitter' ),
'in-reply-to' => array( 'twitter' ),
),
# the IndieAuth token endpoint to use
'token_endpoint' => 'https://tokens.indieauth.com/token',
# the command used to build the site
'command' => '/home/denverpr/new/bundle exec jekyll build',
);
return $config;
?>
It's been quite a while since I've looked at this code. I haven't followed along with any developments or changes that the Micropub spec may have undergone, or any modifications to the token process.
I see you have the token endpoint defined in your config; do you also have the necessary <link rel="token_endpoint" href="https://tokens.indieauth.com/token"> bits in your HTML somewhere?
<!-- indieweb begin -->
<link rel="alternate" type="application/atom+xml" class="h-feed" title="RSS Feed for DenverProphit.us" href="/feed.xml" />
<link href="https://twitter.com/{{site.socialmedia.twitter}}" rel="me">
<link href="https://facebook.com/{{site.socialmedia.facebook}}" rel="me">
<link rel="authorization_endpoint" href="https://indieauth.com/auth">
<link rel="token_endpoint" href="https://tokens.indieauth.com/token">
<link rel="webmention" href="https://webmention.io/denverprophit.us/webmention" />
<link rel="pingback" href="https://webmention.io/denverprophit.us/xmlrpc" />
<link rel="micropub" href="/micropub/index.php">
<!-- indieweb end -->
Was this ever working for you? If so, when did it stop, and what changes might have happened between when it last worked and now?
Can you get any of the Micropub tests working correctly?
The error you reported only happens in one place in the code. Do you have any errors in your web server logs?
@skpy none. I checked domlogs.
34.245.151.164 - - [27/Oct/2020:15:41:51 -0400] "GET /micropub/index.php?q=syndicate-to&post-type=repost HTTP/1.1" 401 74 "-" "-"
34.245.151.164 - - [27/Oct/2020:15:41:51 -0400] "GET /micropub/index.php?q=config HTTP/1.1" 401 74 "-" "-"
34.245.151.164 - - [27/Oct/2020:15:43:13 -0400] "POST /micropub/index.php HTTP/1.1" 401 74 "-" "-"
34.245.151.164 - - [27/Oct/2020:15:43:14 -0400] "GET /micropub/index.php?q=syndicate-to&post-type=repost HTTP/1.1" 401 74 "-" "-"
34.245.151.164 - - [27/Oct/2020:15:43:14 -0400] "GET /micropub/index.php?q=config HTTP/1.1" 401 74 "-" "-"
34.245.151.164 - - [27/Oct/2020:15:45:13 -0400] "POST /micropub/index.php HTTP/1.1" 401 74 "-" "-"
34.245.151.164 - - [27/Oct/2020:15:45:13 -0400] "GET /micropub/index.php?q=syndicate-to&post-type=repost HTTP/1.1" 401 74 "-" "-"
34.245.151.164 - - [27/Oct/2020:15:45:13 -0400] "GET /micropub/index.php?q=config HTTP/1.1" 401 74 "-" "-"
So authorization is failing.
Was this ever working for you? If so, when did it stop, and what changes might have happened between when it last worked and now?
Can you get any of the Micropub tests working correctly?
Never implemented micropub. I tried to login via email submission to https://micropub.rocks/ and never got the email.