docs: change config snippets to use defineConfig (#7546)

This commit is contained in:
Shahed Nasser
2024-05-30 16:47:28 +03:00
committed by GitHub
parent ddfd757277
commit fe96bd39b1
51 changed files with 489 additions and 718 deletions
@@ -27,7 +27,7 @@ By default, admin users and customers can login with all installed auth provider
To limit the auth providers that used for admin users and customers, use the [authMethodsPerActor option](/references/medusa-config#http-authMethodsPerActor-1-3) in Medusa's configurations:
```js title="medusa-config.js"
module.exports = {
module.exports = defineConfig({
projectConfig: {
http: {
authMethodsPerActor: {
@@ -38,7 +38,7 @@ module.exports = {
},
// ...
}
}
})
```
---
@@ -15,35 +15,41 @@ In this document, you'll learn about the options of the Auth Module.
## providers
```js title="medusa-config.js"
const modules = {
const { Modules } = require("@medusajs/modules-sdk")
// ...
module.exports = defineConfig({
// ...
auth: {
resolve: "@medusajs/auth",
options: {
providers: [
{
name: "emailpass",
scopes: {
store: {},
admin: {},
},
},
{
name: "google",
scopes: {
admin: {
clientID: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
callbackURL: process.env.GOOGLE_CALLBACK_URL,
successRedirectUrl:
process.env.GOOGLE_SUCCESS_REDIRECT_URL,
modules: {
[Modules.AUTH]: {
resolve: "@medusajs/auth",
options: {
providers: [
{
name: "emailpass",
scopes: {
store: {},
admin: {},
},
},
},
],
},
},
}
{
name: "google",
scopes: {
admin: {
clientID: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
callbackURL: process.env.GOOGLE_CALLBACK_URL,
successRedirectUrl:
process.env.GOOGLE_SUCCESS_REDIRECT_URL,
},
},
},
],
},
}
}
})
```
The `providers` option is an array of objects indicating the auth providers to register, their scopes, and configurations.
@@ -69,22 +69,7 @@ const { success, authIdentity } =
## Configure Auth Module
To use the Auth Module, enable it in the `modules` object in `medusa-config.js`:
```js title="medusa-config.js"
const { Modules } = require("@medusajs/modules-sdk")
// ...
const modules = {
// ...
[Modules.AUTH]: true,
}
```
{/* ### Module Options
Refer to [this documentation](./module-options/page.mdx) for details on the module's options. */}
Refer to [this documentation](./module-options/page.mdx) for details on the module's options.
---