MCPcopy Create free account
hub / github.com/netlify/gotrue / setCookieToken

Method setCookieToken

api/token.go:216–232  ·  view source on GitHub ↗
(config *conf.Configuration, tokenString string, session bool, w http.ResponseWriter)

Source from the content-addressed store, hash-verified

214}
215
216func (a *API) setCookieToken(config *conf.Configuration, tokenString string, session bool, w http.ResponseWriter) error {
217 exp := time.Second * time.Duration(config.Cookie.Duration)
218 cookie := &http.Cookie{
219 Name: config.Cookie.Key,
220 Value: tokenString,
221 Secure: true,
222 HttpOnly: true,
223 Path: "/",
224 }
225 if !session {
226 cookie.Expires = time.Now().Add(exp)
227 cookie.MaxAge = config.Cookie.Duration
228 }
229
230 http.SetCookie(w, cookie)
231 return nil
232}
233
234func (a *API) clearCookieToken(ctx context.Context, w http.ResponseWriter) {
235 config := getConfig(ctx)

Callers 3

VerifyMethod · 0.95
RefreshTokenGrantMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected