Add app password support to Photoprism

This commit is contained in:
Joe Baumgartner 2024-09-08 07:30:35 -05:00
parent 865ca73ebc
commit f57b2741ea
No known key found for this signature in database
2 changed files with 15 additions and 0 deletions

View File

@ -14,3 +14,12 @@ widget:
username: admin username: admin
password: password 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: <app password from Photoprism>
```

View File

@ -32,6 +32,12 @@ export default async function photoprismProxyHandler(req, res) {
username: widget.username, username: widget.username,
password: widget.password, 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); const [status, contentType, data] = await httpProxy(url, params);