26 lines
748 B
JavaScript
26 lines
748 B
JavaScript
import { getConfig } from '@edx/frontend-platform';
|
|
import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
|
|
|
|
// eslint-disable-next-line import/prefer-default-export
|
|
export async function getThirdPartyAuthContext(urlParams) {
|
|
const requestConfig = {
|
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
params: urlParams,
|
|
isPublic: true,
|
|
};
|
|
|
|
const { data } = await getAuthenticatedHttpClient()
|
|
.get(
|
|
`${getConfig().LMS_BASE_URL}/api/mfe_context`,
|
|
requestConfig,
|
|
)
|
|
.catch((e) => {
|
|
throw (e);
|
|
});
|
|
return {
|
|
fieldDescriptions: data.registrationFields || {},
|
|
optionalFields: data.optionalFields || {},
|
|
thirdPartyAuthContext: data.contextData || {},
|
|
};
|
|
}
|