diff --git a/README.md b/README.md index 2d61f76..5203a80 100644 --- a/README.md +++ b/README.md @@ -57,14 +57,13 @@ To run the tests, run this command: ./vendor/bin/phpunit --verbose src/tests/DescopeSDKTest.php ``` -## Other Code Samples +## Running the PHP Sample App -1. [PHP Sample App](https://github.com/descope/php-sdk/sample/) -2. [WordPress Plugin](https://github.com/descope-sample-apps/wordpress-plugin) +In the `sample/static/descope.js`, replace the **projectId** with your Descope Project ID, which you can find in the [Descope Console](https://app.descope.com/settings/project). -## Running the PHP Sample App +If you haven't already, make sure you run the composer command listed above, to install the necessary SDK packages. -Run this command, from the root directory, to install the necessary dependencies and start the sample app: +Then, run this command from the root directory, to start the sample app: ``` php -S localhost:3000 -t sample/ @@ -72,6 +71,12 @@ php -S localhost:3000 -t sample/ The app should now be accessible at http://localhost:3000/ from your web browser. +This sample app showcases a Descope Flow using the WebJS SDK and PHP sessions to retain user information across multiple pages. It also showcases initializing the SDK and using it to validate the session token from formData sent from `login.php`. + +## Other Code Samples + +1. [WordPress Plugin](https://github.com/descope-sample-apps/wordpress-plugin) + ## Feedback ### Contributing diff --git a/sample/login.php b/sample/login.php index 533bbb8..fb9ef99 100644 --- a/sample/login.php +++ b/sample/login.php @@ -12,48 +12,60 @@
diff --git a/sample/logout.php b/sample/logout.php index d30a396..444b1b1 100644 --- a/sample/logout.php +++ b/sample/logout.php @@ -1,6 +1,25 @@ -// Redirect back to home page -header('Location: /index.php'); \ No newline at end of file + + + + + + + + + + + diff --git a/sample/styles.css b/sample/styles.css new file mode 100644 index 0000000..708dce2 --- /dev/null +++ b/sample/styles.css @@ -0,0 +1,43 @@ +body { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + height: 100vh; + margin: 0; + background-color: #f2f2f2; /* Light grey background */ +} +h1 { + margin-bottom: 30px; +} +.dashboard-button { + padding: 10px 20px; + font-size: 1.2em; + background-color: #008cba; /* Blue background */ + color: white; + border: none; + border-radius: 5px; + cursor: pointer; +} +.dashboard-button:hover { + background-color: #007b9e; /* Darken background */ +} +.container { + text-align: center; +} +.session-token-container { + background-color: #333; + color: #fff; + padding: 10px; + border-radius: 5px; + width: 80%; + word-wrap: break-word; + margin: 0 auto; +} +#container { + display: flex; + justify-content: center; + align-items: center; + width: 100%; + height: 100vh; +}