MCPcopy
hub / github.com/logto-io/logto / signInAndGetUserApi

Function signInAndGetUserApi

packages/integration-tests/src/helpers/profile.ts:64–82  ·  view source on GitHub ↗
(
  username: string,
  password: string,
  config?: Partial<LogtoConfig>,
  /**
   * The Accept-Language header value.
   */
  locale?: string
)

Source from the content-addressed store, hash-verified

62};
63
64export const signInAndGetUserApi = async (
65 username: string,
66 password: string,
67 config?: Partial<LogtoConfig>,
68 /**
69 * The Accept-Language header value.
70 */
71 locale?: string
72) => {
73 const client = await initClientAndSignInForDefaultTenant(username, password, config);
74 const accessToken = await client.getAccessToken();
75
76 return baseApi.extend({
77 headers: {
78 Authorization: `Bearer ${accessToken}`,
79 ...conditional(locale && { 'Accept-Language': locale }),
80 },
81 });
82};

Calls 2

getAccessTokenMethod · 0.45

Tested by

no test coverage detected