mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-13 06:04:13 -04:00
fix: third-party cookie issues with CodeAlly login (#46090)
This commit is contained in:
@@ -207,10 +207,22 @@ class ShowCodeAlly extends Component<ShowCodeAllyProps> {
|
||||
userToken = null
|
||||
} = this.props;
|
||||
|
||||
// Initial CodeAlly login includes a tempToken in redirect URL
|
||||
const queryParams = new URLSearchParams(window.location.search);
|
||||
const codeAllyTempToken: string | null = queryParams.get('tempToken');
|
||||
|
||||
const tempToken = codeAllyTempToken ? `tempToken=${codeAllyTempToken}` : '';
|
||||
|
||||
// Include a unique param to avoid CodeAlly caching issues
|
||||
const date = `date=${Date.now()}`;
|
||||
|
||||
// User token for submitting CodeRoad tutorials
|
||||
const envVariables = userToken
|
||||
? `&envVariables=CODEROAD_WEBHOOK_TOKEN=${userToken}`
|
||||
? `envVariables=CODEROAD_WEBHOOK_TOKEN=${userToken}`
|
||||
: '';
|
||||
|
||||
const goBackTo = `goBackTo=${window.location.href}`;
|
||||
|
||||
const isPartiallyCompleted = partiallyCompletedChallenges.some(
|
||||
challenge => challenge.id === challengeId
|
||||
);
|
||||
@@ -226,7 +238,7 @@ class ShowCodeAlly extends Component<ShowCodeAllyProps> {
|
||||
className='codeally-frame'
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
sandbox='allow-modals allow-forms allow-popups allow-scripts allow-same-origin'
|
||||
src={`https://codeally.io/embed/?repoUrl=${url}${envVariables}`}
|
||||
src={`https://codeally.io/embed/?repoUrl=${url}&${goBackTo}&${envVariables}&${tempToken}&${date}`}
|
||||
title='Editor'
|
||||
/>
|
||||
</LearnLayout>
|
||||
|
||||
Reference in New Issue
Block a user