diff --git a/bin/create.dart b/bin/create.dart index 4c6f32a..f23c1c4 100644 --- a/bin/create.dart +++ b/bin/create.dart @@ -592,8 +592,8 @@ Next steps: cd $path${runFlutterCreate ? '' : '\n flutter create --project-name . # generate platform folders\n flutter pub get'} flutter run -Then update the Solid app registration (clientId, redirectUris, link) in -lib/app.dart and the constants in lib/constants/app.dart for your deployment. +Then update the Solid app registration (appClientId, appRedirectUris, appLink) +and the other constants in lib/constants/app.dart for your deployment. On macOS/iOS, enable signing once in Xcode (Signing & Capabilities -> Team) so the keychain-backed login can build. See the generated README for details. diff --git a/templates/solidui/README.md.tmpl b/templates/solidui/README.md.tmpl index 47a6543..95b0e04 100644 --- a/templates/solidui/README.md.tmpl +++ b/templates/solidui/README.md.tmpl @@ -25,11 +25,12 @@ flutter run A few values were filled in with placeholders when this project was generated. Update them for your own deployment: -- **Solid app registration** in `lib/app.dart` — the `clientId`, - `redirectUris` and `link` passed to `SolidLogin`. These identify your app to - the Solid server during login. **The `clientId` URL must actually resolve to - a Client Identifier Document (a `client-profile.jsonld`) that lists these - exact `redirectUris`.** Until you publish that document (and list your +- **Solid app registration** in `lib/constants/app.dart` — `appClientId`, + `appRedirectUris`, `appPostLogoutRedirectUris` and `appLink`, passed to + `SolidLogin` from `lib/app.dart`. These identify your app to the Solid server + during login. **The `appClientId` URL must actually resolve to a Client + Identifier Document (a `client-profile.jsonld`) that lists these exact + redirect URIs.** Until you publish that document (and list your `{{orgName}}.{{schemeName}}://redirect` scheme in it), the identity provider has no client to validate and the login page will not appear — this is the most common reason a freshly generated app cannot reach the login screen. See the diff --git a/templates/solidui/lib/app.dart.tmpl b/templates/solidui/lib/app.dart.tmpl index 83fa024..80e3bd2 100644 --- a/templates/solidui/lib/app.dart.tmpl +++ b/templates/solidui/lib/app.dart.tmpl @@ -43,26 +43,17 @@ class App extends StatelessWidget { // The application folder created on the user's POD. - appDirectory: '{{projectName}}', + appDirectory: appPodDirectory, - // TODO Update the following Solid app registration details to point at - // your own deployment. They identify your app to the Solid server - // during login, and the clientId MUST resolve to a client profile - // document that lists these exact redirectUris (see the solid/ folder). - // See https://solidproject.org for more information. - // - // Note: the custom redirect scheme drops underscores from the project - // name ('{{orgName}}.{{schemeName}}'), because a URI scheme may not - // contain underscores. Every other identifier keeps the project name. + // Solid app registration details. Update these in lib/constants/app.dart + // to point at your own deployment; the clientId there must resolve to a + // client profile document listing exactly these redirect URIs (see the + // solid/ folder). See https://solidproject.org for more information. - link: 'https://github.com/example/{{projectName}}', - clientId: - 'https://solidcommunity.au/apps/{{projectName}}/client-profile.jsonld', - redirectUris: [ - 'https://solidcommunity.au/apps/{{projectName}}/redirect.html', - '{{orgName}}.{{schemeName}}://redirect', - 'http://localhost:4400/redirect', - ], + link: appLink, + clientId: appClientId, + redirectUris: appRedirectUris, + postLogoutRedirectUris: appPostLogoutRedirectUris, child: appScaffold, ), ); diff --git a/templates/solidui/lib/constants/app.dart.tmpl b/templates/solidui/lib/constants/app.dart.tmpl index 0493bf7..f5b7739 100644 --- a/templates/solidui/lib/constants/app.dart.tmpl +++ b/templates/solidui/lib/constants/app.dart.tmpl @@ -12,6 +12,51 @@ import 'package:solidui/solidui.dart' const String appTitle = '{{appTitle}}'; +// ── Solid app registration ─────────────────────────────────────────────────── + +/// Solid OIDC client registration for {{appName}}. +/// +/// These values identify the app to the Solid server during login. They are +/// gathered here so you can update them in one place when you deploy to your +/// own infrastructure. +/// +/// [appClientId] MUST resolve to a publicly hosted client profile document +/// (the template in the `solid/` folder) whose `redirect_uris` and +/// `post_logout_redirect_uris` list exactly the URIs below. If they do not +/// match, the identity provider will reject the login. See the `solid/README` +/// and https://solidproject.org for more information. +/// +/// Note: the custom redirect scheme drops underscores from the project name +/// ('{{orgName}}.{{schemeName}}'), because a URI scheme may not contain +/// underscores. Every other identifier keeps the full project name. + +const String appClientId = + 'https://solidcommunity.au/apps/{{projectName}}/client-profile.jsonld'; + +/// One redirect URI per platform; SolidUI selects the right one at runtime +/// based on the current platform. Keep this list in step with the +/// `redirect_uris` in the hosted client profile document. + +const List appRedirectUris = [ + 'https://solidcommunity.au/apps/{{projectName}}/redirect.html', + '{{orgName}}.{{schemeName}}://redirect', + 'http://localhost:4400/redirect', +]; + +/// Where the identity provider returns the user after logging out. By default +/// we reuse the login redirect URIs, mirroring the hosted client profile. + +const List appPostLogoutRedirectUris = appRedirectUris; + +/// The application folder created on the user's POD to store {{appName}} data. + +const String appPodDirectory = '{{projectName}}'; + +/// Homepage opened from the login page's info button. Point this at your own +/// project page or documentation. + +const String appLink = 'https://github.com/example/{{projectName}}'; + /// Shared upload configuration for every `SolidFile` view in {{appName}}. /// /// Restricts the file picker (both the toolbar Upload button and the side diff --git a/templates/solidui/solid/README.md.tmpl b/templates/solidui/solid/README.md.tmpl index 2f30817..49ec8f2 100644 --- a/templates/solidui/solid/README.md.tmpl +++ b/templates/solidui/solid/README.md.tmpl @@ -44,5 +44,5 @@ curl -I https://solidcommunity.au/apps/{{projectName}}/client-profile.jsonld # ``` The `redirect_uris` in the published document must be byte-for-byte identical to -the `redirectUris` list in `lib/app.dart`, including the +the `appRedirectUris` list in `lib/constants/app.dart`, including the `{{orgName}}.{{schemeName}}://redirect` custom scheme.