User authentication and management
- authSignup - Sign up new user
- authSignin - Sign in user
Sign up new user
import { SDK } from "@aerostack/sdk-node";
const sdk = new SDK({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await sdk.authentication.authSignup({
email: "user@example.com",
password: "SecurePass123!",
name: "John Doe",
});
console.log(result);
}
run();The standalone function version of this method:
import { SDKCore } from "@aerostack/sdk-node/core.js";
import { authenticationAuthSignup } from "@aerostack/sdk-node/funcs/authenticationAuthSignup.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await authenticationAuthSignup(sdk, {
email: "user@example.com",
password: "SecurePass123!",
name: "John Doe",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("authenticationAuthSignup failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.AuthSignupRequestBody | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.AuthSignupResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
Sign in user
import { SDK } from "@aerostack/sdk-node";
const sdk = new SDK({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await sdk.authentication.authSignin({
email: "Tina.Buckridge@yahoo.com",
password: "nIQ75VVtUTq8bO4",
});
console.log(result);
}
run();The standalone function version of this method:
import { SDKCore } from "@aerostack/sdk-node/core.js";
import { authenticationAuthSignin } from "@aerostack/sdk-node/funcs/authenticationAuthSignin.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await authenticationAuthSignin(sdk, {
email: "Tina.Buckridge@yahoo.com",
password: "nIQ75VVtUTq8bO4",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("authenticationAuthSignin failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.AuthSigninRequestBody | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.AuthSigninResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |