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
@@ -163,6 +165,41 @@ Get all other pages of paginated results and return the complete data
163
165
- Returns: <code>[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Cloudnode.PaginatedData](#interface-cloudnodepaginateddatat)<T>></code> All of the data in 1 page
164
166
- Throws: <code>[Cloudnode.Error](#interface-cloudnodeerror)</code> Error returned by the API
165
167
168
+
<aname="cloudnodeauthloginuser-password"></a>
169
+
170
+
### `cloudnode.auth.login(user, password)`
171
+
172
+
Create a session using user ID/username/e-mail and password.
173
+
174
+
> **Note**: Logging in can only be performed from residential IP. Proxying this endpoint will likely not work. It is normally not recommended to use this endpoint to gain API access. Instead, create a token from your account to use with the API.
175
+
176
+
-`user` <code>[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)</code> User ID (starts with `user_`), username or e-mail address.
177
+
-`password` <code>[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)</code> The password of the account.
178
+
- Returns: <code>[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Cloudnode.ApiResponse](#class-cloudnodeapiresponset)<{session: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>></code> Session token. Also returned in `Set-Cookie` header.
Create an account and session. After signing up, a welcome e-mail is sent to confirm your e-mail address.
190
+
191
+
> **Note**: Registering an account can only be performed from residential IP. Proxying this endpoint will likely not work. Creating multiple/alternate accounts is not allowed as per the Terms of Service.
192
+
193
+
-`username` <code>[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)</code> The username to use for the account. Must be between 3 and 32 characters long. Cannot start with `user_`. May contain only letters, numbers, dashes and underscores. Must be unique.
194
+
-`email` <code>[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)</code> The e-mail address to register. A valid unique non-disposable e-mail that can receive mail is required.
195
+
-`password` <code>[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)</code> The password to use for the account. Must be at least 15 characters, or 8 characters if it contains a mix of letters, numbers and symbols.
196
+
- Returns: <code>[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Cloudnode.ApiResponse](#class-cloudnodeapiresponset)<{session: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>></code> Session token. Also returned in `Set-Cookie` header.
Copy file name to clipboardExpand all lines: browser/Cloudnode.js
+37Lines changed: 37 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -334,6 +334,43 @@ class Cloudnode {
334
334
returnawaitthis.#sendRequest({"type": "operation","description": "Refresh current token. The token that was used to authenticate the request will be deleted. A new token with a new ID but the same permissions will be created and returned. The lifespan of the new token will be the same as the old one, starting from the time of the request. This operation effectively allows a token to be used indefinitely.","token": "token.refresh","method": "POST","path": "/token/refresh","parameters": {},"returns": [{"status": 201,"type": "Token"},{"status": 422,"type": "Error & {code: \"INVALID_DATA\"}"},{"status": 401,"type": "Error & {code: \"UNAUTHORIZED\"}"},{"status": 403,"type": "Error & {code: \"NO_PERMISSION\"}"},{"status": 429,"type": "Error & {code: \"RATE_LIMITED\"}"},{"status": 500,"type": "Error & {code: \"INTERNAL_SERVER_ERROR\"}"},{"status": 503,"type": "Error & {code: \"MAINTENANCE\"}"}]},{},{},{});
335
335
},
336
336
};
337
+
auth={
338
+
/**
339
+
* Create an account and session. After signing up, a welcome e-mail is sent to confirm your e-mail address.
340
+
341
+
> **Note**: Registering an account can only be performed from residential IP. Proxying this endpoint will likely not work. Creating multiple/alternate accounts is not allowed as per the Terms of Service.
342
+
* @POST /auth/register
343
+
* @param username The username to use for the account. Must be between 3 and 32 characters long. Cannot start with `user_`. May contain only letters, numbers, dashes and underscores. Must be unique.
344
+
* @param email The e-mail address to register. A valid unique non-disposable e-mail that can receive mail is required.
345
+
* @param password The password to use for the account. Must be at least 15 characters, or 8 characters if it contains a mix of letters, numbers and symbols.
* @returns Session token. Also returned in `Set-Cookie` header.
352
+
*/
353
+
register: async(username,email,password)=>{
354
+
returnawaitthis.#sendRequest({"type": "operation","description": "Create an account and session. After signing up, a welcome e-mail is sent to confirm your e-mail address.\n\n> **Note**: Registering an account can only be performed from residential IP. Proxying this endpoint will likely not work. Creating multiple/alternate accounts is not allowed as per the Terms of Service.","method": "POST","path": "/auth/register","parameters": {"body": {"username": {"description": "The username to use for the account. Must be between 3 and 32 characters long. Cannot start with `user_`. May contain only letters, numbers, dashes and underscores. Must be unique.","type": "string","required": true},"email": {"description": "The e-mail address to register. A valid unique non-disposable e-mail that can receive mail is required.","type": "string","required": true},"password": {"description": "The password to use for the account. Must be at least 15 characters, or 8 characters if it contains a mix of letters, numbers and symbols.","type": "string","required": true}}},"returns": [{"status": 201,"type": "{session: string}","description": "Session token. Also returned in `Set-Cookie` header."},{"status": 422,"type": "Error & {code: \"INVALID_DATA\"}"},{"status": 403,"type": "Error & {code: \"IP_REJECTED\"}"},{"status": 429,"type": "Error & {code: \"RATE_LIMITED\"}"},{"status": 500,"type": "Error & {code: \"INTERNAL_SERVER_ERROR\"}"},{"status": 503,"type": "Error & {code: \"MAINTENANCE\"}"}]},{},{},{ username, email, password });
355
+
},
356
+
/**
357
+
* Create a session using user ID/username/e-mail and password.
358
+
359
+
> **Note**: Logging in can only be performed from residential IP. Proxying this endpoint will likely not work. It is normally not recommended to use this endpoint to gain API access. Instead, create a token from your account to use with the API.
360
+
* @POST /auth/login
361
+
* @param user User ID (starts with `user_`), username or e-mail address.
* @returns Session token. Also returned in `Set-Cookie` header.
369
+
*/
370
+
login: async(user,password)=>{
371
+
returnawaitthis.#sendRequest({"type": "operation","description": "Create a session using user ID/username/e-mail and password.\n\n> **Note**: Logging in can only be performed from residential IP. Proxying this endpoint will likely not work. It is normally not recommended to use this endpoint to gain API access. Instead, create a token from your account to use with the API.","method": "POST","path": "/auth/login","parameters": {"body": {"user": {"description": "User ID (starts with `user_`), username or e-mail address.","type": "string","required": true},"password": {"description": "The password of the account.","type": "string","required": true}}},"returns": [{"status": 201,"type": "{session: string}","description": "Session token. Also returned in `Set-Cookie` header."},{"status": 401,"type": "Error & {code: \"UNAUTHORIZED\"}"},{"status": 403,"type": "Error & {code: \"IP_REJECTED\"}"},{"status": 429,"type": "Error & {code: \"RATE_LIMITED\"}"},{"status": 500,"type": "Error & {code: \"INTERNAL_SERVER_ERROR\"}"},{"status": 503,"type": "Error & {code: \"MAINTENANCE\"}"}]},{},{},{ user, password });
0 commit comments