You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**postQuery(uri) : Send a POST request and retrieve the response**
55
55
56
-
This is identical to ```query(uri)```, except that the request will be a POST rather than a GET.
56
+
This is identical to ```query(uri)```, except that the request will be a POST rather than a GET.
57
57
58
58
Note that the parameters can only be passed as a query string as part of the uri, which is all Plex requires. (```Content-Length``` will always be zero)
An authenticator is used by plex-api to authenticate its request against Plex Servers with a PlexHome setup. The most common authentication mechanism is by username and password.
126
+
127
+
You can provide your own custom authentication mechanism, read more about custom authenticators below.
128
+
129
+
### Credentials: username and password
130
+
131
+
Comes bundled with plex-api. Just provide `options.username` and `options.password` when creating a PlexAPI instance and you are good to go.
132
+
133
+
See the [plex-api-credentials](https://www.npmjs.com/package/plex-api-credentials) module for more information about its inner workings.
134
+
135
+
### Custom authenticator
136
+
137
+
In its simplest form an `authenticator` is an object with **one required** function `authenticate()` which should return the autentication token needed by plex-api to satisfy Plex Server.
138
+
139
+
An optional method `initialize()` could be implemented if you need reference to the created PlexAPI instance when it's created.
140
+
141
+
```js
142
+
{
143
+
// OPTIONAL
144
+
initialize:function(plexApi) {
145
+
// plexApi === the PlexAPI instance just created
146
+
},
147
+
// REQUIRED
148
+
authenticate:function(plexApi, callback) {
149
+
// plexApi === the PlexAPI instance requesting the authentication token
150
+
151
+
// invoke callback if something fails
152
+
if (somethingFailed) {
153
+
returncallback(newError('I haz no cluez about token!'));
154
+
}
155
+
156
+
// or when you have a token
157
+
callback(null, 'I-found-this-token');
158
+
}
159
+
}
160
+
```
161
+
123
162
## HTTP API Documentation
124
163
For more information about the API capabilities, see the [unofficial Plex API documentation](https://code.google.com/p/plex-api/w/list).
0 commit comments