diff --git a/client/src/templates/Challenges/codeally/show.tsx b/client/src/templates/Challenges/codeally/show.tsx index 6fd66637a15..bcf84f1e3e9 100644 --- a/client/src/templates/Challenges/codeally/show.tsx +++ b/client/src/templates/Challenges/codeally/show.tsx @@ -207,10 +207,22 @@ class ShowCodeAlly extends Component { 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 { 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' />