Skip to content

Redirection server logic#80

Open
javiert-okta wants to merge 9 commits intorefactor-api-endpointsfrom
redirection-server-logic
Open

Redirection server logic#80
javiert-okta wants to merge 9 commits intorefactor-api-endpointsfrom
redirection-server-logic

Conversation

@javiert-okta
Copy link
Contributor

@javiert-okta javiert-okta commented Jan 23, 2026

By submitting a PR to this repository, you agree to the terms within the Auth0 Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.

Description

The following PR adds the logic to the step one that redirects the request to the auth0 tenant and retrieves the code. The changes include:

  • Add auto scrolling logic for each step
  • Add methods to retrieve local storage data and store in local state across components
  • Fix redirection on api endpoints
  • Add schema to validate local storage data with zod
  • Add LinkButton component as Button variant
  • Generate request data for step one

Screenshots:

image

References

Link to Figma design

Testing

IMPORTANT:

The functionality for OIDC can only be tested on a specifically controlled url which is why the following link should be used:
OIDC TESTING URL

  • Verify that the app starts with the step one selected and has the correct request info on display
  • Click on Start and verify you are redirected to the auth0 tenant login page
  • Login and verify that the response is seen on the step two and is visible
  • Step one is now hidden

Checklist

  • I have added documentation for new/changed functionality in this PR or in auth0.com/docs
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used, if not the default branch

@github-actions
Copy link

@github-actions
Copy link

};
if (authDataResponse.authCode) {
setCurrentStepIndex(1);
debuggerSteps.currentStep = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debuggerSteps is a const from getAppData() return value. This line attempts to mutate it.

setDebuggerStepsData(prev => ({ ...prev, currentStep: 1 }));

}
const parsedData = JSON.parse(savedData);
const validated = AppDataSchema.parse(parsedData);
const debuggerSteps: DebuggerStepsData = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The debuggerSteps object is missing the non-optional currentStep field, even though it's defined in the schema.

}
if (auth) setAuthData(auth);
if (!auth) {
fetch("api/auth_data")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fetchc all does not have any errorhandling

requestData: RequestData,
): string => {
const { url, params } = requestData;
const completeUrl = `${url}?${params.map((param, idx) => `${idx > 0 ? "&" : ""}${param.key}=${param.key === "scope" ? encodeURI(param.value) : param.value}`).join("")}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't other (than scope) url params be encoded? You could use URLSearchParams to do this.

export const getCompleteUrlFromRequestData = (
  requestData: RequestData,
): string => {
  const { url, params } = requestData;
  const searchParams = new URLSearchParams();
  params.forEach(param => {
    searchParams.append(param.key, param.value);
  });
  return `${url}?${searchParams.toString()}`;
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants