summaryrefslogtreecommitdiffhomepage
path: root/cloud/function/src/auth.ts
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-08-20 16:52:43 -0400
committerDax Raad <[email protected]>2025-08-20 17:01:18 -0400
commit522bed6b7dabd09328b3c8aae90b06ab06344623 (patch)
tree905dca3e2b3fb4e765d03f2ec78e285f19a31155 /cloud/function/src/auth.ts
parentdda672284c69ad399029316a63677cf49cbc54f3 (diff)
downloadopencode-522bed6b7dabd09328b3c8aae90b06ab06344623.tar.gz
opencode-522bed6b7dabd09328b3c8aae90b06ab06344623.zip
ignore: cloud stuff
Diffstat (limited to 'cloud/function/src/auth.ts')
-rw-r--r--cloud/function/src/auth.ts9
1 files changed, 8 insertions, 1 deletions
diff --git a/cloud/function/src/auth.ts b/cloud/function/src/auth.ts
index fe31651e5..bbea41540 100644
--- a/cloud/function/src/auth.ts
+++ b/cloud/function/src/auth.ts
@@ -2,11 +2,12 @@ import { Resource } from "sst"
import { z } from "zod"
import { issuer } from "@openauthjs/openauth"
import { createSubjects } from "@openauthjs/openauth/subject"
-import { CodeProvider } from "@openauthjs/openauth/provider/code"
import { GithubProvider } from "@openauthjs/openauth/provider/github"
import { GoogleOidcProvider } from "@openauthjs/openauth/provider/google"
import { CloudflareStorage } from "@openauthjs/openauth/storage/cloudflare"
import { Account } from "@opencode/cloud-core/account.js"
+import { Workspace } from "@opencode/cloud-core/workspace.js"
+import { Actor } from "@opencode/cloud-core/actor.js"
type Env = {
AuthStorage: KVNamespace
@@ -117,6 +118,12 @@ export default {
email: email!,
})
}
+ await Actor.provide("account", { accountID, email }, async () => {
+ const workspaces = await Account.workspaces()
+ if (workspaces.length === 0) {
+ await Workspace.create()
+ }
+ })
return ctx.subject("account", accountID, { accountID, email })
},
}).fetch(request, env, ctx)