@sociate/sociate-api-sdk
Version:
Javascript client for Sociate AI APIs
23 lines (22 loc) • 791 B
JavaScript
export class AuthAPI {
httpClient;
constructor(httpClient) {
this.httpClient = httpClient;
}
/**
* Logs in a user with the provided credentials.
* @param credentials - The user's login credentials.
* @returns A promise that resolves to the login response, which includes user data and tokens.
*/
async login(credentials) {
return await this.httpClient.post('/auth/login', credentials);
}
/**
* Generates a token for the provided app.
* @param body - The app ID, app secret, and scopes.
* @returns A promise that resolves to the token response, which includes user data, company, and tokens.
*/
async generateToken(body) {
return await this.httpClient.post('/auth/generate-token', body);
}
}