Skip to content

Commit 4b68574

Browse files
committed
Release v0.1.3
Use client metadata JSON endpoint
1 parent 497db76 commit 4b68574

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [0.1.3] 2024-06-15
10+
### Changed
11+
- Added client metadata JSON endpoint and updated client_id in IndieAuth requests
12+
- See https://github.com/indieweb/indieauth/issues/133
13+
914
## [0.1.2] 2024-04-07
1015
### Added
1116
- Add `draft` scope and `post-status` support [#21](https://github.com/gRegorLove/indiebookclub/issues/21)

app/Controller/AuthController.php

+22-2
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,31 @@ class AuthController extends Controller
2626
{
2727
private function initClient(): void
2828
{
29-
// The client ID should be the home page of your app.
30-
Client::$clientID = sprintf('https://%s/', $_ENV['IBC_HOSTNAME']);
29+
// The client ID is the URL that returns client information in JSON
30+
// See https://github.com/indieweb/indieauth/issues/133
31+
Client::$clientID = $_ENV['IBC_BASE_URL'] . '/id';
3132

3233
// The redirect URL is where the user will be returned to after they approve the request.
3334
Client::$redirectURL = $_ENV['IBC_BASE_URL'] . $this->router->pathFor('auth_callback');
35+
36+
// Previously: The client ID should be the home page of your app.
37+
// Client::$clientID = sprintf('https://%s/', $_ENV['IBC_HOSTNAME']);
38+
}
39+
40+
public function client_metadata(
41+
ServerRequestInterface $request,
42+
ResponseInterface $response,
43+
array $args
44+
) {
45+
return $response->withJson([
46+
'client_id' => $_ENV['IBC_BASE_URL'] . '/id',
47+
'client_name' => 'indiebookclub',
48+
'client_uri' => $_ENV['IBC_BASE_URL'] . '/',
49+
'logo_uri' => $_ENV['IBC_BASE_URL'] . '/images/book.svg',
50+
'redirect_uris' => [
51+
$_ENV['IBC_BASE_URL'] . $this->router->pathFor('auth_callback'),
52+
],
53+
]);
3454
}
3555

3656
/**

app/routes.php

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
->setName($prefix . '_re_authorize');
1717
});
1818

19+
$app->get('/id', 'AuthController:client_metadata')
20+
->setName('client_metadata');
1921
$app->get('/', 'PageController:index')
2022
->setName('index');
2123
$app->get('/about', 'PageController:about')

app/settings.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
return [
66
'settings' => [
7-
'version' => '0.1.1',
7+
'version' => '0.1.3',
88
'offline' => false,
99
'developer_ip' => '127.0.0.1',
1010
'developer_domains' => [

0 commit comments

Comments
 (0)