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_URL
server env variableIn 0.13.0 Wasp introduces a new server env variable
WASP_SERVER_URL
that 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.com
In development, Wasp sets the
WASP_SERVER_URL
tohttp://localhost:3001
by default.Migrating a deployed appIf you are migrating a deployed app, you will need to define the
WASP_SERVER_URL
server 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}/callback
Check the new redirect URLs for Google and GitHub in Wasp's docs.
Update the
configFn
for the OAuth providersIf you didn't use the
configFn
option, you can skip this step.If you used the
configFn
to configure thescope
for the OAuth providers, you will need to rename thescope
property toscopes
.Also, the object returned from
configFn
no longer needs to include the Client ID and the Client Secret. You can remove them from the object thatconfigFn
returns.- 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
userSignupFields
fields to use the newprofile
formatIf you didn't use the
userSignupFields
option, you can skip this step.The data format for the
profile
that 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.