diff --git a/docs/widgets/services/photoprism.md b/docs/widgets/services/photoprism.md index c6e9c3f6..6c5f7d5a 100644 --- a/docs/widgets/services/photoprism.md +++ b/docs/widgets/services/photoprism.md @@ -14,3 +14,12 @@ widget: username: admin password: password ``` + +If using app passwords, you can create one and specify that for authorization. + +```yaml +widget: + type: photoprism + url: http://photoprism.host.or.ip:port + authToken: +``` diff --git a/src/widgets/photoprism/proxy.js b/src/widgets/photoprism/proxy.js index 5aca3775..c2fee38e 100644 --- a/src/widgets/photoprism/proxy.js +++ b/src/widgets/photoprism/proxy.js @@ -32,6 +32,12 @@ export default async function photoprismProxyHandler(req, res) { username: widget.username, password: widget.password, }); + } else if (widget.authToken) { + params.headers = { "Content-Type": "application/json", Authorization: `Bearer ${widget.authToken}` }; + + params.body = JSON.stringify({ + authToken: widget.authToken, + }); } const [status, contentType, data] = await httpProxy(url, params);