Migration from 0.12.X to 0.13.X
This guide only covers the migration from 0.12.X to 0.13.X. If you are migrating from 0.11.X or earlier, please read the migration guide from 0.11.X to 0.12.X first.
What's new in 0.13.0?
OAuth providers got an overhaul
Wasp 0.13.0 switches away from using Passport for our OAuth providers in favor of Arctic from the Lucia ecosystem. This change simplifies the codebase and makes it easier to add new OAuth providers in the future.
We added Keycloak as an OAuth provider
Wasp now supports using Keycloak as an OAuth provider.
How to migrate?
Migrate your OAuth setup
We had to make some breaking changes to upgrade the OAuth setup to the new Arctic lib.
Follow the steps below to migrate:
-
Define the
WASP_SERVER_URLserver env variableIn 0.13.0 Wasp introduces a new server env variable
WASP_SERVER_URLthat you need to define. This is the URL of your Wasp server and it's used to generate the redirect URL for the OAuth providers.Server env variablesWASP_SERVER_URL=https://your-wasp-server-url.comIn development, Wasp sets the
WASP_SERVER_URLtohttp://localhost:3001by default.Migrating a deployed appIf you are migrating a deployed app, you will need to define the
WASP_SERVER_URLserver env variable in your deployment environment.Read more about setting env variables in production here.
-
Update the redirect URLs for the OAuth providers
The redirect URL for the OAuth providers has changed. You will need to update the redirect URL for the OAuth providers in the provider's dashboard.
- Before
- After
{clientUrl}/auth/login/{provider}{serverUrl}/auth/{provider}/callbackCheck the new redirect URLs for Google and GitHub in Wasp's docs.
-
Update the
configFnfor the OAuth providersIf you didn't use the
configFnoption, you can skip this step.If you used the
configFnto configure thescopefor the OAuth providers, you will need to rename thescopeproperty toscopes.Also, the object returned from
configFnno longer needs to include the Client ID and the Client Secret. You can remove them from the object thatconfigFnreturns.- Before
- After
google.tsexport function getConfig() {
return {
clientID: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
scope: ['profile', 'email'],
}
}google.tsexport function getConfig() {
return {
scopes: ['profile', 'email'],
}
} -
Update the
userSignupFieldsfields to use the newprofileformatIf you didn't use the
userSignupFieldsoption, you can skip this step.The data format for the
profilethat you receive from the OAuth providers has changed. You will need to update your code to reflect this change.- Before
- After
google.tsimport { defineUserSignupFields } from 'wasp/server/auth'
export const userSignupFields = defineUserSignupFields({
displayName: (data: any) => data.profile.displayName,
})google.tsimport { defineUserSignupFields } from 'wasp/server/auth'
export const userSignupFields = defineUserSignupFields({
displayName: (data: any) => data.profile.name,
})Wasp now directly forwards what it receives from the OAuth providers. You can check the data format for Google and GitHub in Wasp's docs.
That's it!
You should now be able to run your app with the new Wasp 0.13.0.