-
Hi, Lately, I've encountered an issue in my Storefront app where querying products for a collection is no longer working as expected (everything was functioning normally before 12/14). For instance, when I run the following query: collection(slug: "test-collection", channel: "default-channel") {
name
description
seoDescription
seoTitle
products(first: 100) {
edges {
node {
...ProductListItem
}
}
}
} I receive the following error:
Previously, I used an access token obtained from https://cloud.saleor.io/tokens, and all queries and mutations were functioning correctly until this error occurred suddenly. Issue Reproduction Steps: Recreating the issue is possible by utilizing Saleor GraphQL playground with the Authorization header (previously, querying collection products worked fine with a token from https://cloud.saleor.io/tokens). {
"Authorization": "Bearer access_token_obtained_from_https://cloud.saleor.io/tokens"
} Steps I've Taken: ❌ I attempted to create a new token from https://cloud.saleor.io/tokens, but the issue persists. export async function executeGraphQL<Result, Variables>(
...
const response = await fetch(process.env.NEXT_PUBLIC_SALEOR_API_URL, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.SALEOR_API_ACCESS_TOKEN}`,
...headers,
},
body: JSON.stringify({
query: operation.toString(),
...(variables && { variables }),
}),
cache: cache,
next: { revalidate },
});
... However, since this token has an expiration, I'm curious if there's a token type suitable for my Saleor Storefront app (NextJS) that ensures all queries have the necessary permissions without expiration. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Issue UpdatedUpon refreshing the page (without making any code changes), the problem appears to have been resolved. (I'm still using the token from https://cloud.saleor.io/tokens though.) |
Beta Was this translation helpful? Give feedback.
-
@nvhoang55 you are using user tokens instead of application token. You will find application tokens in your Saleor dashboard (not cloud console), go to Configuration > Webhook and events > Create app > Assign permission |
Beta Was this translation helpful? Give feedback.
@nvhoang55 you are using user tokens instead of application token. You will find application tokens in your Saleor dashboard (not cloud console), go to Configuration > Webhook and events > Create app > Assign permission