Had same issue, found an older solution for v3 that I implemented like this in v4 : src/index.js with the bootstrap method.
async bootstrap(/*{ strapi }*/) {
const pluginStore = strapi.store({ type: 'plugin', name: 'users-permissions' })
// Get actual grant config
const prevGrantConfig = (await pluginStore.get({ key: 'grant' })) || {}
// Setup Microsoft grant config
const endpoint = process.env.MICROSOFT_AUTH_TENANT_ID || 'common'
const microsoftGrantConfig = {
authorize_url: `https://login.microsoftonline.com/${endpoint}/oauth2/v2.0/authorize`,
access_url: `https://login.microsoftonline.com/${endpoint}/oauth2/v2.0/token`
}
// Merge previous config and overwrite with our custom Microsoft grant config
const newGrantConfig = {
...prevGrantConfig,
microsoft: {
...prevGrantConfig.microsoft,
...microsoftGrantConfig
}
}
// Overwrite grant Config
await pluginStore.set({key: 'grant', value: newGrantConfig})
},
Source : Microsoft provider doesn’t work · Issue #3248 · strapi/strapi (github.com)