@albirex/platformatic-logto 1.2.1 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +69 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # Platformatic Logto Integration
2
+ This project provides a seamless integration between [Platformatic](https://platformatic.dev/) and [Logto](https://logto.io/), enabling robust authentication and authorization mechanisms in your Platformatic applications.
3
+
4
+ Based on [@platformatic/db-authorization](https://github.com/platformatic/platformatic/tree/main/packages/db-authorization)
5
+
6
+ ## Features
7
+ - Authentication Middleware: Easily authenticate users using Logto within your Platformatic services.
8
+ - Authorization Support: Implement role-based access control (RBAC) by leveraging Logto's authorization capabilities (roles and scopes).
9
+ - Customizable Hooks: Extend and customize authentication flows to fit your application's needs.
10
+ - TypeScript Support: Written in TypeScript for type safety and improved developer experience.
11
+
12
+ ## Installation
13
+ To install the package, use your preferred package manager:
14
+
15
+ ```
16
+ npm install platformatic-logto
17
+ # or
18
+ yarn add platformatic-logto
19
+ # or
20
+ pnpm add platformatic-logto
21
+ ```
22
+ ## Usage
23
+ Here's a basic example of how to integrate platformatic-logto into your Platformatic application:
24
+ ```
25
+ import { buildServer } from 'platformatic';
26
+ import { logtoPlugin } from 'platformatic-logto';
27
+
28
+ const app = await buildServer({
29
+ // ... your Platformatic configuration
30
+ plugins: {
31
+ paths: ['./plugins/logto-plugin.js'],
32
+ },
33
+ });
34
+
35
+ // Register the Logto plugin
36
+ app.register(logtoPlugin, {
37
+ appId: 'your-logto-app-id',
38
+ appSecret: 'your-logto-app-secret',
39
+ endpoint: 'https://your-logto-endpoint',
40
+ // Additional configuration options
41
+ });
42
+
43
+ await app.listen();
44
+ ```
45
+
46
+ Ensure you replace 'your-logto-app-id', 'your-logto-app-secret', and 'https://your-logto-endpoint' with your actual Logto application credentials and endpoint.
47
+
48
+ ## Configuration Options
49
+ The logtoPlugin accepts the following configuration options:
50
+
51
+ | Property | Type | Description |
52
+ | ----- | ----------------- | ------------- |
53
+ | appId | string | Your Logto application's ID. |
54
+ | appSecret | string | Your Logto application's secret. |
55
+ | endpoint | string | The base URL of your Logto instance. |
56
+ | audience | string, optional | Specify the intended audience for the tokens. |
57
+ | scopes | string[], optional | Define the scopes required for your application. |
58
+ | redirectUri | string, optional | The URI to redirect to after authentication. |
59
+
60
+
61
+ You can also provide custom handlers for specific events, such as token validation or user session management.
62
+
63
+ ## License
64
+ This project is licensed under the MIT License.
65
+
66
+ ## Contributing
67
+ Contributions are welcome! Please open an issue or submit a pull request for any enhancements or bug fixes.
68
+
69
+ For more information and advanced usage, please refer to the official documentation for [Platformatic](https://platformatic.dev/docs/db/plugin) and [LogTo](https://docs.logto.io/introduction).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@albirex/platformatic-logto",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",