File tree 2 files changed +16
-1
lines changed
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ MAIL_PASSWORD="<REDACTED>"
54
54
SMTP_PORT=" <REDACTED>"
55
55
SMTP_HOST=" <REDACTED>"
56
56
APP_KEY=" <REDACTED>"
57
+ ENV=" development"
57
58
```
58
59
59
60
4 . Run the server in development mode
@@ -85,6 +86,7 @@ All the configuration is done through env variables :
85
86
- ` SMTP_PORT ` : your smtp port
86
87
- ` SMTP_HOST ` : your smtp host
87
88
- ` APP_KEY ` : your app key, which is a random string that is used to encrypt access tokens
89
+ - ` ENV ` : the environment in which the app is running (development, production)
88
90
89
91
## Tests
90
92
Original file line number Diff line number Diff line change @@ -33,7 +33,13 @@ func (a *AuthControllerImpl) Callback() fiber.Handler {
33
33
}
34
34
token_cookie := new (fiber.Cookie )
35
35
token_cookie .Name = "gists.access_token"
36
- token_cookie .HTTPOnly = false
36
+ token_cookie .HTTPOnly = true
37
+ if utils .Get ("ENV" ) == "development" {
38
+ token_cookie .Secure = false
39
+ } else {
40
+ token_cookie .Domain = ".gists.app" // hardcoded
41
+ token_cookie .Secure = true
42
+ }
37
43
token_cookie .Value = token
38
44
c .Cookie (token_cookie )
39
45
return c .Redirect (utils .Get ("FRONTEND_URL" ))
@@ -82,6 +88,13 @@ func (a *AuthControllerImpl) VerifyAuthToken() fiber.Handler {
82
88
token_cookie .Name = "gists.access_token"
83
89
token_cookie .HTTPOnly = true
84
90
token_cookie .Value = jwt_token
91
+
92
+ if utils .Get ("ENV" ) == "development" {
93
+ token_cookie .Secure = false
94
+ } else {
95
+ token_cookie .Domain = ".gists.app" // hardcoded
96
+ token_cookie .Secure = true
97
+ }
85
98
c .Cookie (token_cookie )
86
99
return c .Status (200 ).JSON (fiber.Map {"message" : "You are now logged in" })
87
100
}
You can’t perform that action at this time.
0 commit comments