Skip to content

Commit

Permalink
Release v0.1.3
Browse files Browse the repository at this point in the history
Use client metadata JSON endpoint
  • Loading branch information
gRegorLove committed Jun 15, 2024
1 parent 497db76 commit 4b68574
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.1.3] 2024-06-15
### Changed
- Added client metadata JSON endpoint and updated client_id in IndieAuth requests
- See https://github.com/indieweb/indieauth/issues/133

## [0.1.2] 2024-04-07
### Added
- Add `draft` scope and `post-status` support [#21](https://github.com/gRegorLove/indiebookclub/issues/21)
Expand Down
24 changes: 22 additions & 2 deletions app/Controller/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,31 @@ class AuthController extends Controller
{
private function initClient(): void
{
// The client ID should be the home page of your app.
Client::$clientID = sprintf('https://%s/', $_ENV['IBC_HOSTNAME']);
// The client ID is the URL that returns client information in JSON
// See https://github.com/indieweb/indieauth/issues/133
Client::$clientID = $_ENV['IBC_BASE_URL'] . '/id';

// The redirect URL is where the user will be returned to after they approve the request.
Client::$redirectURL = $_ENV['IBC_BASE_URL'] . $this->router->pathFor('auth_callback');

// Previously: The client ID should be the home page of your app.
// Client::$clientID = sprintf('https://%s/', $_ENV['IBC_HOSTNAME']);
}

public function client_metadata(
ServerRequestInterface $request,
ResponseInterface $response,
array $args
) {
return $response->withJson([
'client_id' => $_ENV['IBC_BASE_URL'] . '/id',
'client_name' => 'indiebookclub',
'client_uri' => $_ENV['IBC_BASE_URL'] . '/',
'logo_uri' => $_ENV['IBC_BASE_URL'] . '/images/book.svg',
'redirect_uris' => [
$_ENV['IBC_BASE_URL'] . $this->router->pathFor('auth_callback'),
],
]);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions app/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
->setName($prefix . '_re_authorize');
});

$app->get('/id', 'AuthController:client_metadata')
->setName('client_metadata');
$app->get('/', 'PageController:index')
->setName('index');
$app->get('/about', 'PageController:about')
Expand Down
2 changes: 1 addition & 1 deletion app/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

return [
'settings' => [
'version' => '0.1.1',
'version' => '0.1.3',
'offline' => false,
'developer_ip' => '127.0.0.1',
'developer_domains' => [
Expand Down

0 comments on commit 4b68574

Please sign in to comment.