sion0921
sion0921
WWasp-lang
Created by Trigaten on 10/3/2024 in #🙋questions
Failed to load resource: A server with the specified hostname could not be
specifically server errors
35 replies
WWasp-lang
Created by Trigaten on 10/3/2024 in #🙋questions
Failed to load resource: A server with the specified hostname could not be
check fly.io for error logs
35 replies
WWasp-lang
Created by NEROX on 9/26/2024 in #🙋questions
Customer Portal not displaying?
🤷‍♀️
63 replies
WWasp-lang
Created by NEROX on 9/26/2024 in #🙋questions
Customer Portal not displaying?
I've changed httpRoute
httpRoute: (POST, "/payments-webhook")
httpRoute: (POST, "/payments-webhook")
Solved it for me
63 replies
WWasp-lang
Created by NEROX on 9/26/2024 in #🙋questions
Customer Portal not displaying?
No description
63 replies
WWasp-lang
Created by NEROX on 9/26/2024 in #🙋questions
Customer Portal not displaying?
Once a solution is found, I'll provide an update
63 replies
WWasp-lang
Created by NEROX on 9/26/2024 in #🙋questions
Customer Portal not displaying?
Like you, @NEROX , I'm also dealing with the same issue and haven't found a solution yet.
63 replies
WWasp-lang
Created by NEROX on 9/26/2024 in #🙋questions
Customer Portal not displaying?
@NEROX I believe you are using wrong Stripe API version [2023-08-16] check
@src/payment/stripe/stripeClients.ts
@src/payment/stripe/stripeClients.ts
to verify
63 replies
WWasp-lang
Created by NEROX on 9/26/2024 in #🙋questions
Customer Portal not displaying?
Only starting from today, I've been receiving the same errors. I'm looking into this as well
63 replies
WWasp-lang
Created by NEROX on 9/26/2024 in #🙋questions
Customer Portal not displaying?
Hmm, maybe something with new stripe update? Im getting when trying to purchase a plan
[404] POST http://localhost:3001/payments-webhook
[404] POST http://localhost:3001/payments-webhook
63 replies
WWasp-lang
Created by sion0921 on 9/18/2024 in #🙋questions
How to generate Authorization header JWT token for custom API endpoint?
So far, it looks good. However, you need to add some additional code to the background.js script to save the token in browser storage.
// handle messages from external sources (like your website in background.js)
const saveExtensionToken = async (token) => {
await chrome.storage.local.set({ extensionToken: token });
};

chrome.runtime.onMessageExternal.addListener(
(message, sender, sendResponse) => {
console.log("Received external message:", message, "from", sender);
if (message.action === "saveExtensionToken") {
saveExtensionToken(message.token).then(() => {
sendResponse({ success: true });
});
return true;
} else if (message.action === "checkInstalled") {
sendResponse({ installed: true });
}
}
);
// handle messages from external sources (like your website in background.js)
const saveExtensionToken = async (token) => {
await chrome.storage.local.set({ extensionToken: token });
};

chrome.runtime.onMessageExternal.addListener(
(message, sender, sendResponse) => {
console.log("Received external message:", message, "from", sender);
if (message.action === "saveExtensionToken") {
saveExtensionToken(message.token).then(() => {
sendResponse({ success: true });
});
return true;
} else if (message.action === "checkInstalled") {
sendResponse({ installed: true });
}
}
);
97 replies
WWasp-lang
Created by sion0921 on 9/18/2024 in #🙋questions
How to generate Authorization header JWT token for custom API endpoint?
I would greatly appreciate it if @miho could provide input on whether using getSessionId from 'wasp/client/api' as the primary method for authentication and authorization is appropriate. Mate @miho could you please take a look at this issue?
97 replies
WWasp-lang
Created by sion0921 on 9/18/2024 in #🙋questions
How to generate Authorization header JWT token for custom API endpoint?
I think the session ID is limited to the client side of the website. While I might be mistaken, I haven't discovered a method to generate it on the server side.
97 replies
WWasp-lang
Created by sion0921 on 9/18/2024 in #🙋questions
How to generate Authorization header JWT token for custom API endpoint?
jwt.sign(userPayload, 'your-secret-key');
jwt.sign(userPayload, 'your-secret-key');
This code snippet from the AI answer will generate a JWT token in a completely different format compared to what you get from sessionId. So, ynfortunately, no, this method won't generate a valid token to access context.user.
97 replies
WWasp-lang
Created by sion0921 on 9/18/2024 in #🙋questions
How to generate Authorization header JWT token for custom API endpoint?
@Sven The purpose of this thread is to understand how to access 'context.user'. And I think its partially solved ✅ You can access it from the frontend using 'getSessionId()', then from your Chrome extension when making a request to your custom API endpoint. You will need to use that token to gain access to 'context.user'. Here's how I send the fetch request (google chrome extension code):
const { extensionToken } = await browser.storage.local.get(
"extensionToken"
);
if (!extensionToken) {
throw new Error("No extension token found");
}
const response = await fetch(SERVER_API_URL[mode], {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${extensionToken}`,
},
body: JSON.stringify({ payload: { message: textContent } }),
});
const { extensionToken } = await browser.storage.local.get(
"extensionToken"
);
if (!extensionToken) {
throw new Error("No extension token found");
}
const response = await fetch(SERVER_API_URL[mode], {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${extensionToken}`,
},
body: JSON.stringify({ payload: { message: textContent } }),
});
97 replies
WWasp-lang
Created by sion0921 on 9/18/2024 in #🙋questions
How to generate Authorization header JWT token for custom API endpoint?
export const yourEndpoint = async (req, res, context) => {
if (!context.user) {
return res.status(401).json({ message: 'Unauthorized' });
}
export const yourEndpoint = async (req, res, context) => {
if (!context.user) {
return res.status(401).json({ message: 'Unauthorized' });
}
97 replies
WWasp-lang
Created by sion0921 on 9/18/2024 in #🙋questions
How to generate Authorization header JWT token for custom API endpoint?
😆
97 replies
WWasp-lang
Created by sion0921 on 9/18/2024 in #🙋questions
How to generate Authorization header JWT token for custom API endpoint?
No description
97 replies
WWasp-lang
Created by sion0921 on 9/18/2024 in #🙋questions
How to generate Authorization header JWT token for custom API endpoint?
Other people have accomplished this using custom endpoints and email verification. I cannot incorporate extensive custom logic into every request because my extension needs to respond quickly. Hence, the name of my SaaS is SpellFast. My only feasible option is to implement the excisting Wasp authentication mechanism to maintain speed.
97 replies
WWasp-lang
Created by sion0921 on 9/18/2024 in #🙋questions
How to generate Authorization header JWT token for custom API endpoint?
@miho "Is it possible to prevent getSessionId from 'wasp/client/api' from expiring? 👉👈
97 replies