Im successfully using the migration plugin to call certain scripts on strapi init.
now im trying to pre-configure the github provider with clientId and clientSecret + enabling it.
i only found an old script to do so:
https://gist.githubusercontent.com/isabellachen/b0c8dc99a418a15b24c3ef1d6eec4b7b/raw/6244582ef4a4f9717daaebae2383709c4a5ca8f1/bootstrap-strapi.js
ofc this wont work with a current strapi version.
this is what i’ve got so far:
module.exports = async () => {
const pluginStore = await strapi.store({
environment: strapi.config.environment,
type: 'plugin',
name: 'users-permissions'
})
const grantConfig = {
github: {
enabled: true,
key: 'REPLACED',
secret: 'REPLACED',
redirect_uri: '/auth/github/callback',
scope: ['user', 'user:email']
}
}
const prevGrantConfig = (await pluginStore.get({ key: 'grant' })) || {}
if (!prevGrantConfig || Object.keys(prevGrantConfig).toString() !== Object.keys(grantConfig).toString()) {
Object.keys(grantConfig).forEach((key) => {
if (key in prevGrantConfig) {
grantConfig[key] = { ...grantConfig[key], ...prevGrantConfig[key] }
}
})
await pluginStore.set({ key: 'grant', value: grantConfig })
}
}
Can anyone see whats missing or wrong?
Or maybe point me in the right direction?
Thank you soo much
This topic has been created from a Discord post (1238666950670811176) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord