fix: Fix cookie issue

This commit is contained in:
Wanjohi
2025-06-10 15:34:21 +03:00
parent 6eee40fcbe
commit 661d9d2e56
3 changed files with 16 additions and 1 deletions

View File

@@ -5,12 +5,21 @@ import { domain } from "./dns";
import { secret } from "./secret"; import { secret } from "./secret";
import { postgres } from "./postgres"; import { postgres } from "./postgres";
const urls = new sst.Linkable("Urls", {
properties: {
api: `https://api.${domain}`,
auth: `https://auth.${domain}`,
site: $dev ? "http://localhost:3000" : `https://console.${domain}`,
}
})
const apiFn = new sst.aws.Function("ApiFn", { const apiFn = new sst.aws.Function("ApiFn", {
vpc, vpc,
handler: "packages/functions/src/api/index.handler", handler: "packages/functions/src/api/index.handler",
streaming: !$dev, streaming: !$dev,
link: [ link: [
bus, bus,
urls,
auth, auth,
postgres, postgres,
secret.SteamApiKey, secret.SteamApiKey,

View File

@@ -236,7 +236,7 @@ export namespace SteamApi {
setCookie(c, "user_id", user.id); setCookie(c, "user_id", user.id);
const returnUrl = `${new URL(c.req.url).origin}/steam/callback/${userID}` const returnUrl = `${new URL(Resource.Urls.api).origin}/steam/callback/${userID}`
const params = new URLSearchParams({ const params = new URLSearchParams({
'openid.ns': 'http://specs.openid.net/auth/2.0', 'openid.ns': 'http://specs.openid.net/auth/2.0',

6
sst-env.d.ts vendored
View File

@@ -105,6 +105,12 @@ declare module "sst" {
"name": string "name": string
"type": "sst.aws.Bucket" "type": "sst.aws.Bucket"
} }
"Urls": {
"api": string
"auth": string
"site": string
"type": "sst.sst.Linkable"
}
"VPC": { "VPC": {
"bastion": string "bastion": string
"type": "sst.aws.Vpc" "type": "sst.aws.Vpc"