Skip to content

Migration of sample app to Nexjs SDK v4 #180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

tusharpandey13
Copy link

Migration of sample app to Nexjs SDK v4

# Your Auth0 tenant domain
AUTH0_DOMAIN='YOUR_AUTH0_DOMAIN.auth0.com'
# The base url of your application
APP_BASE_URL='http://localhost:3000'
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we keep the order, so we simplify the diff?

Copy link
Contributor

Choose a reason for hiding this comment

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

Order isnt maintained

Copy link
Contributor

@frederikprijck frederikprijck left a comment

Choose a reason for hiding this comment

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

Can we move updating nextjs to v14 or 15 in another PR?

"@babel/preset-typescript"
],
"plugins": []
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this neccessary to update the SDK?


If you do not wish to use an API or observe the API call working, you should not specify the `AUTH0_AUDIENCE` and `AUTH0_SCOPE` values in the next steps.
If you do not wish to use an API or observe the API call working, you should not specify the `AUTH0_AUDIENCE` value in the next steps.
Copy link
Contributor

Choose a reason for hiding this comment

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

AUTH0_AUDIENCE?


### Configure credentials

The project needs to be configured with your Auth0 Domain, Client ID and Client Secret for the authentication flow to work.

To do this, first copy `.env.local.example` into a new file in the same folder called `.env.local`, and replace the values with your own Auth0 application credentials (see more info about [loading environmental variables in Next.js](https://nextjs.org/docs/basic-features/environment-variables)):
To do this, first copy `.env.local.example` into a new file in the same folder called `.env.local`, and replace the values with your own Auth0 application credentials:
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this link (https://nextjs.org/docs/basic-features/environment-variables) no longer relevant?

import initFontAwesome from '../utils/initFontAwesome';

// Initialize FontAwesome icons
initFontAwesome();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this neccessary for updating our SDK?

Comment on lines +9 to +12
const { isAuthenticated, user, guardComponent } = useAuthGuard();

// If not authenticated or loading, show guard component
if (!isAuthenticated) return guardComponent;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think introducing useAuthGuard here causes unneccesary complications in the diff.

window.location.href = '/auth/login';
}
guardComponent = <Loading />;
}
Copy link
Contributor

@frederikprijck frederikprijck Mar 26, 2025

Choose a reason for hiding this comment

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

I think guardComponent is not the best idea in the sense that it isnt clear what it actually is where used.

If customers want that, they can, but let's refrain from adding this complexity in our sample but stay explicit.

transformIgnorePatterns: [
"/node_modules/(?!highlight\\.js)"
]
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this ?

authorizationParameters: {
scope: "openid profile email offline_access read:shows",
}
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we have this ts file, and the js file?

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