From 3f82ec2f757c62c25a31b461e0a0cddc14886117 Mon Sep 17 00:00:00 2001
From: Aaron Parecki Your token endpoint returned a response that was not understood. Got an error response from the token endpoint: '.$this->auth['error_description'].' All required values were found! You are now signed in. The token endpoint did not return an access token. The The token endpoint did not return a "me" parameter. The The token endpoint did not return a "scope" parameter. The Below is the raw response from your token endpoint (= $this->tokenEndpoint ?>): Could not find your token endpoint. We found it last time, so double check nothing on your website has changed in the mean time. = $this->errorDescription ?> The token endpoint is where this app will make a request to get an access token after obtaining authorization. You need to set your token endpoint in a The Micropub endpoint is the URL this app will use to post new photos. You need to set your Micropub endpoint in a Clicking the button below will take you to your authorization server which is where you will allow this app to be able to post to your site. Clicking "Post" will post this note to your Micropub endpoint. Below is some information about the request that will be made. This is a simple Micropub client for creating text posts on your own website. To use it, you will need to turn your website into an OAuth provider, and implement a Micropub endpoint that this app will send requests to. Once you've signed in, you'll see an interface like the below which you can use to write a post. Clicking "post" will make a Micropub request to your endpoint.
+
+ The Creating a Micropub Endpoint tutorial will walk you through how to handle incoming POST requests from apps like this. You can create your own authorization endpoint, but it's easier to use an existing service such as IndieAuth.com. To delegate to IndieAuth.com, you can use the markup provided below.Bad response from token endpoint
+ Error
+ = $this->auth['error'] ?>
+ = k($this->auth, 'error_description') ? ('Success!
+
+ Missing
+ access_token
access_token
parameter is the token the client will use to make requests to the Micropub endpoint.Missing
+ me
me
parameter lets this client know what user the token is for.Missing
+ scope
scope
parameter lets this client what permission the token represents.Token endpoint response
+
+ Error
+ = $this->error ?>
+
+Token Endpoint
+
+ = $this->tokenEndpoint ?>
<link>
tag on your home page or in an HTTP header.Micropub Endpoint
+
+ = $this->micropubEndpoint ?>
<link>
tag on your home page or in an HTTP header.Ready!
+
+
+Authorization: Bearer XXXXXXXX
+
+
+
+### Verifying Access Tokens
+
+Before you can begin processing the photo, you must first verify the access token is valid
+and contains at least the "post" scope.
+
+How exactly you do this is dependent on your architecture. You can query the token endpoint
+to check if an access token is still valid. See [https://tokens.indieauth.com/#verify tokens.indieauth.com]
+for more information.
+
+Once you have looked up the token info, you need to make a determination
+about whether that access token is still valid. You'll have the following information
+at hand that can be used to check:
+
+* `me` - The user who this access token corresponds to.
+* `client_id` - The app that generated the token.
+* `scope` - The list of scopes that were authorized by the user.
+* `issued_at` - The date the token was issued.
+
+Keep in mind that it may be possible for another user besides yourself to have created
+an access token at your token endpoint, so the first thing you'll do when verifying
+is making sure the "me" parameter matches your own domain. This way you are the only
+one that can create posts on your website.
+
+
+### Validating the Request Parameters
+
+A valid request to create a post will contain the parameters listed above. For now,
+you can verify the presence of everything in the list, or you can try to genericize your
+micropub endpoint so that it can also create [http://ownyourgram.com/creating-a-micropub-endpoint photo posts].
+
+At a bare minimum, a Micropub request will contain the following:
+
+* `h=entry`
+* `content`
+
+The access token must also contain at least the "post" scope.
+
+
+### The Response
+
+Once you've validated the access token and checked for the presence of all required parameters,
+you can create a post in your website with the information provided.
+
+If a post was successfully created, the endpoint must return an `HTTP 201` response with a
+`Location` header that points to the URL of the post. No body is required for the response.
+
+
+HTTP/1.1 201 Created
+Location: http://example.com/post/100
+
+
+If there was an error, the response should include an HTTP error code as appropriate,
+and optionally an HTML or other body with more information. Below is a list of possible errors.
+
+* `HTTP 401 Unauthorized` - No access token was provided in the request.
+* `HTTP 403 Forbidden` - An access token was provided, but the authenticated user does not have permission to complete the request.
+* `HTTP 400 Bad Request` - Something was wrong with the request, such as a missing "h" parameter, or other missing data. The response body may contain more human-readable information about the error.
+
+
+
+= Markdown(ob_get_clean()) ?>
diff --git a/views/dashboard.php b/views/dashboard.php
new file mode 100644
index 0000000..7a35ba1
--- /dev/null
+++ b/views/dashboard.php
@@ -0,0 +1,214 @@
+
+ Last response from your Micropub endpoint (= relative_time($this->response_date) ?>)
+
+ = htmlspecialchars($this->test_response) ?>
+
+
+
+
+
+
+ me
+
+ = session('me') ?>
(should be your URL)
+
+ scope
+
+ = $this->micropub_scope ?>
(should be a space-separated list of permissions including "post")
+
+ micropub endpoint
+
+ = $this->micropub_endpoint ?>
(should be a URL)
+
+ access token
+ String of length = strlen($this->micropub_access_token) ?>= (strlen($this->micropub_access_token) > 0) ? (', ending in
+ ' . substr($this->micropub_access_token, -7) . '
') : '' ?> (should be greater than length 0)Introduction
+
+Configuring Endpoints
+
+Authorization Endpoint
+= partial('partials/auth-endpoint-help') ?>
+
+Token Endpoint
+= partial('partials/token-endpoint-help') ?>
+
+Micropub Endpoint
+= partial('partials/micropub-endpoint-help') ?>
+
+<link rel="authorization_endpoint" href="https://indieauth.com/auth">
Link: <https://indieauth.com/auth>; rel="authorization_endpoint"
diff --git a/views/partials/micropub-endpoint-help.php b/views/partials/micropub-endpoint-help.php
new file mode 100644
index 0000000..35705ca
--- /dev/null
+++ b/views/partials/micropub-endpoint-help.php
@@ -0,0 +1,3 @@
+ You will need to create a Micropub endpoint for your website which can create posts on your site. Once you've created the Micropub endpoint, you can indicate its location using the markup below.
+<link rel="micropub" href="https://= (property_exists($this, 'meParts') ? $this->meParts['host'] : 'example.com') ?>/micropub">
+ Link: <https://= (property_exists($this, 'meParts') ? $this->meParts['host'] : 'example.com') ?>/micropub>; rel="micropub"
diff --git a/views/partials/token-endpoint-help.php b/views/partials/token-endpoint-help.php
new file mode 100644
index 0000000..ea5442e
--- /dev/null
+++ b/views/partials/token-endpoint-help.php
@@ -0,0 +1,6 @@
+ You can create your own token endpoint for + your website which can issue access tokens when given an authorization code, but + it's easier to use an existing service such as tokens.indieauth.com. + To use this service as your token endpoint, use the markup provided below.
+<link rel="token_endpoint" href="https://tokens.indieauth.com/token">
+ Link: <https://tokens.indieauth.com/token>; rel="token_endpoint"
diff --git a/views/signin.php b/views/signin.php
new file mode 100644
index 0000000..228cf32
--- /dev/null
+++ b/views/signin.php
@@ -0,0 +1,10 @@
+
+
+
--
cgit v1.2.3