From f28471df255a6d00c62a030982d2e51b3af82310 Mon Sep 17 00:00:00 2001 From: Barnaby Walters Date: Sat, 12 Jun 2021 23:10:20 +0200 Subject: [PATCH] Cleaned up usage examples --- README.md | 10 ++++++++-- src/Server.php | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index bfd1989..dc049ec 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,14 @@ Typical minimal usage looks something like this: ```php // Somewhere in your app set-up code: $server = new Taproot\IndieAuth\Server([ - 'secret' => APP_INDIEAUTH_SECRET, // A secret key, >= 64 characters long. - 'tokenStorage' => '/../data/auth_tokens/', // A path to store token data, or an object implementing TokenStorageInterface. + // A secret key, >= 64 characters long. + 'secret' => APP_INDIEAUTH_SECRET, + + // A path to store token data, or an object implementing TokenStorageInterface. + 'tokenStorage' => '/../data/auth_tokens/', + + // An authentication callback function, which either returns data about the current user, + // or redirects to/implements an authentication flow. 'handleAuthenticationRequestCallback' => function (ServerRequestInterface $request, string $authenticationRedirect, ?string $normalizedMeUrl) { // If the request is authenticated, return an array with a `me` key containing the // canonical URL of the currently logged-in user. diff --git a/src/Server.php b/src/Server.php index 01061c3..9dc964e 100644 --- a/src/Server.php +++ b/src/Server.php @@ -31,8 +31,14 @@ use Taproot\IndieAuth\Storage\TokenStorageInterface; * * // Somewhere in your app set-up code: * $server = new Taproot\IndieAuth\Server([ - * 'secret' => APP_INDIEAUTH_SECRET, // A secret key, >= 64 characters long. - * 'tokenStorage' => '/../data/auth_tokens/', // A path to store token data, or an object implementing TokenStorageInterface. + * // A secret key, >= 64 characters long. + * 'secret' => APP_INDIEAUTH_SECRET, + * + * // A path to store token data, or an object implementing TokenStorageInterface. + * 'tokenStorage' => '/../data/auth_tokens/', + * + * // An authentication callback function, which either returns data about the current user, + * // or redirects to/implements an authentication flow. * 'handleAuthenticationRequestCallback' => function (ServerRequestInterface $request, string $authenticationRedirect, ?string $normalizedMeUrl) { * // If the request is authenticated, return an array with a `me` key containing the * // canonical URL of the currently logged-in user.