docs: fixes to JS SDK + auth provider guides (#13526)
* docs: fixes to JS SDK + auth provider guides * more fixes * fix lint error
This commit is contained in:
1 parent
92102dcafb
commit
1c4f7bd53a
3 files changed
+18
-14
No files matched your search
@@ -24900,7 +24900,7 @@ The Google Auth Module Provider allows you to authenticate users with their Goog
|
|||||||
### Prerequisites
|
### Prerequisites
|
||||||
|
|
||||||
- [Create a project in Google Cloud.](https://cloud.google.com/resource-manager/docs/creating-managing-projects)
|
- [Create a project in Google Cloud.](https://cloud.google.com/resource-manager/docs/creating-managing-projects)
|
||||||
- [Create authorization credentials. When setting the Redirect Uri, set it to a URL in your frontend that later uses Medusa's callback route to validate the authentication.](https://developers.google.com/identity/protocols/oauth2/web-server#creatingcred)
|
- [Create Oauth client ID credentials. When setting the Redirect Uri, set it to a URL in your frontend (for example, storefront) that later uses Medusa's callback route to validate the authentication.](https://developers.google.com/identity/protocols/oauth2/web-server#creatingcred)
|
||||||
|
|
||||||
To use the Google Auth Module Provider, add the module to the array of providers passed to the Auth Module in your `medusa-config.ts`:
|
To use the Google Auth Module Provider, add the module to the array of providers passed to the Auth Module in your `medusa-config.ts`:
|
||||||
|
|
||||||
@@ -24912,14 +24912,17 @@ import { Modules, ContainerRegistrationKeys } from "@medusajs/framework/utils"
|
|||||||
module.exports = defineConfig({
|
module.exports = defineConfig({
|
||||||
// ...
|
// ...
|
||||||
modules: [
|
modules: [
|
||||||
{
|
|
||||||
// ...
|
// ...
|
||||||
[Modules.AUTH]: {
|
{
|
||||||
resolve: "@medusajs/medusa/auth",
|
resolve: "@medusajs/medusa/auth",
|
||||||
dependencies: [Modules.CACHE, ContainerRegistrationKeys.LOGGER],
|
dependencies: [Modules.CACHE, ContainerRegistrationKeys.LOGGER],
|
||||||
options: {
|
options: {
|
||||||
providers: [
|
providers: [
|
||||||
// other providers...
|
// other providers...
|
||||||
|
{
|
||||||
|
resolve: "@medusajs/medusa/auth-emailpass",
|
||||||
|
id: "emailpass",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
resolve: "@medusajs/medusa/auth-google",
|
resolve: "@medusajs/medusa/auth-google",
|
||||||
id: "google",
|
id: "google",
|
||||||
@@ -24932,7 +24935,6 @@ module.exports = defineConfig({
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
@@ -45033,7 +45035,7 @@ For admin customizations, create this file at `src/admin/lib/config.ts`.
|
|||||||
|
|
||||||
### Admin (Medusa project)
|
### Admin (Medusa project)
|
||||||
|
|
||||||
```ts title="src/admin/lib/config.ts"
|
```ts title="src/admin/lib/sdk.ts"
|
||||||
import Medusa from "@medusajs/js-sdk"
|
import Medusa from "@medusajs/js-sdk"
|
||||||
|
|
||||||
export const sdk = new Medusa({
|
export const sdk = new Medusa({
|
||||||
@@ -45047,7 +45049,7 @@ export const sdk = new Medusa({
|
|||||||
|
|
||||||
### Admin (Medusa Plugin)
|
### Admin (Medusa Plugin)
|
||||||
|
|
||||||
```ts title="src/admin/lib/config.ts"
|
```ts title="src/admin/lib/sdk.ts"
|
||||||
import Medusa from "@medusajs/js-sdk"
|
import Medusa from "@medusajs/js-sdk"
|
||||||
|
|
||||||
export const sdk = new Medusa({
|
export const sdk = new Medusa({
|
||||||
@@ -45061,7 +45063,7 @@ export const sdk = new Medusa({
|
|||||||
|
|
||||||
### Storefront
|
### Storefront
|
||||||
|
|
||||||
```ts title="config.ts"
|
```ts title="sdk.ts"
|
||||||
import Medusa from "@medusajs/js-sdk"
|
import Medusa from "@medusajs/js-sdk"
|
||||||
|
|
||||||
let MEDUSA_BACKEND_URL = "http://localhost:9000"
|
let MEDUSA_BACKEND_URL = "http://localhost:9000"
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ The Google Auth Module Provider allows you to authenticate users with their Goog
|
|||||||
link: "https://cloud.google.com/resource-manager/docs/creating-managing-projects"
|
link: "https://cloud.google.com/resource-manager/docs/creating-managing-projects"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: "Create authorization credentials. When setting the Redirect Uri, set it to a URL in your frontend that later uses Medusa's callback route to validate the authentication.",
|
text: "Create Oauth client ID credentials. When setting the Redirect Uri, set it to a URL in your frontend (for example, storefront) that later uses Medusa's callback route to validate the authentication.",
|
||||||
link: "https://developers.google.com/identity/protocols/oauth2/web-server#creatingcred"
|
link: "https://developers.google.com/identity/protocols/oauth2/web-server#creatingcred"
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
@@ -35,14 +35,17 @@ import { Modules, ContainerRegistrationKeys } from "@medusajs/framework/utils"
|
|||||||
module.exports = defineConfig({
|
module.exports = defineConfig({
|
||||||
// ...
|
// ...
|
||||||
modules: [
|
modules: [
|
||||||
{
|
|
||||||
// ...
|
// ...
|
||||||
[Modules.AUTH]: {
|
{
|
||||||
resolve: "@medusajs/medusa/auth",
|
resolve: "@medusajs/medusa/auth",
|
||||||
dependencies: [Modules.CACHE, ContainerRegistrationKeys.LOGGER],
|
dependencies: [Modules.CACHE, ContainerRegistrationKeys.LOGGER],
|
||||||
options: {
|
options: {
|
||||||
providers: [
|
providers: [
|
||||||
// other providers...
|
// other providers...
|
||||||
|
{
|
||||||
|
resolve: "@medusajs/medusa/auth-emailpass",
|
||||||
|
id: "emailpass",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
resolve: "@medusajs/medusa/auth-google",
|
resolve: "@medusajs/medusa/auth-google",
|
||||||
id: "google",
|
id: "google",
|
||||||
@@ -55,7 +58,6 @@ module.exports = defineConfig({
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ For admin customizations, create this file at `src/admin/lib/config.ts`.
|
|||||||
<CodeTabs group="sdk-project">
|
<CodeTabs group="sdk-project">
|
||||||
<CodeTab label="Admin (Medusa project)" value="admin-medusa-project">
|
<CodeTab label="Admin (Medusa project)" value="admin-medusa-project">
|
||||||
|
|
||||||
```ts title="src/admin/lib/config.ts"
|
```ts title="src/admin/lib/sdk.ts"
|
||||||
import Medusa from "@medusajs/js-sdk"
|
import Medusa from "@medusajs/js-sdk"
|
||||||
|
|
||||||
export const sdk = new Medusa({
|
export const sdk = new Medusa({
|
||||||
@@ -59,7 +59,7 @@ export const sdk = new Medusa({
|
|||||||
</CodeTab>
|
</CodeTab>
|
||||||
<CodeTab label="Admin (Medusa Plugin)" value="admin-medusa-plugin">
|
<CodeTab label="Admin (Medusa Plugin)" value="admin-medusa-plugin">
|
||||||
|
|
||||||
```ts title="src/admin/lib/config.ts"
|
```ts title="src/admin/lib/sdk.ts"
|
||||||
import Medusa from "@medusajs/js-sdk"
|
import Medusa from "@medusajs/js-sdk"
|
||||||
|
|
||||||
export const sdk = new Medusa({
|
export const sdk = new Medusa({
|
||||||
@@ -74,7 +74,7 @@ export const sdk = new Medusa({
|
|||||||
</CodeTab>
|
</CodeTab>
|
||||||
<CodeTab label="Storefront" value="storefront">
|
<CodeTab label="Storefront" value="storefront">
|
||||||
|
|
||||||
```ts title="config.ts"
|
```ts title="sdk.ts"
|
||||||
import Medusa from "@medusajs/js-sdk"
|
import Medusa from "@medusajs/js-sdk"
|
||||||
|
|
||||||
let MEDUSA_BACKEND_URL = "http://localhost:9000"
|
let MEDUSA_BACKEND_URL = "http://localhost:9000"
|
||||||
|
|||||||
Reference in new issue
Block a user