about summary refs log tree commit diff
path: root/users
diff options
context:
space:
mode:
Diffstat (limited to 'users')
-rw-r--r--users/grfn/bbbg/module.nix1
-rw-r--r--users/grfn/bbbg/src/bbbg/discord/auth.clj13
-rw-r--r--users/grfn/bbbg/src/bbbg/web.clj6
3 files changed, 15 insertions, 5 deletions
diff --git a/users/grfn/bbbg/module.nix b/users/grfn/bbbg/module.nix
index cff971396277..297d846f22b6 100644
--- a/users/grfn/bbbg/module.nix
+++ b/users/grfn/bbbg/module.nix
@@ -71,6 +71,7 @@ in {
           PGUSER = cfg.database.user;
           PGDATABASE = cfg.database.name;
           PORT = toString cfg.port;
+          BASE_URL = "https://${cfg.domain}";
         };
 
         script = "${bbbg.server}/bin/bbbg-server";
diff --git a/users/grfn/bbbg/src/bbbg/discord/auth.clj b/users/grfn/bbbg/src/bbbg/discord/auth.clj
index fddd15fd1859..feb8393afb22 100644
--- a/users/grfn/bbbg/src/bbbg/discord/auth.clj
+++ b/users/grfn/bbbg/src/bbbg/discord/auth.clj
@@ -54,15 +54,22 @@
              "guilds.members.read"
              "identify"])
 
-(defn discord-oauth-profile [env]
+(defn discord-oauth-profile [{:keys [base-url] :as env}]
   {:authorize-uri authorization-url
    :access-token-uri access-token-url
    :client-id (::client-id env)
    :client-secret (::client-secret env)
    :scopes scopes
    :launch-uri "/auth/discord"
-   :redirect-uri "/auth/discord/redirect"
-   :landing-uri "/auth/success"})
+   :redirect-uri (str base-url "/auth/discord/redirect")
+   :landing-uri (str base-url "/auth/success")})
+
+(comment
+  (-> "https://bbbg-staging.gws.fyi/auth/login"
+      (java.net.URI/create)
+      (.resolve "https://bbbg.gws.fyi/auth/discord/redirect")
+      str)
+  )
 
 (defn wrap-discord-auth [handler env]
   (wrap-oauth2 handler {:discord (discord-oauth-profile env)}))
diff --git a/users/grfn/bbbg/src/bbbg/web.clj b/users/grfn/bbbg/src/bbbg/web.clj
index f364d734f30f..f9755577a570 100644
--- a/users/grfn/bbbg/src/bbbg/web.clj
+++ b/users/grfn/bbbg/src/bbbg/web.clj
@@ -38,7 +38,8 @@
 (s/def ::config
   (s/merge
    (s/keys :req [::port]
-           :opt [::cookie-secret])
+           :opt [::cookie-secret
+                 ::base-url])
    ::discord.auth/config))
 
 (s/fdef make-server
@@ -58,7 +59,8 @@
    (u/remove-nils
     (merge
      {::port (:port env 8888)
-      ::cookie-secret (some-> env :cookie-secret string->cookie-secret)}
+      ::cookie-secret (some-> env :cookie-secret string->cookie-secret)
+      ::base-url (:base-url env)}
      (discord.auth/env->config)))))
 
 (defn dev-config []