Browse Source

pass valid context to Exchange code

tags/v1.8.1
Morgan Bazalgette 1 year ago
parent
commit
91d8c6234c
Signed by: Morgan Bazalgette <the@howl.moe> GPG Key ID: 40D328300D245DA5
1 changed files with 4 additions and 1 deletions
  1. 4
    1
      helpers.go

+ 4
- 1
helpers.go View File

@@ -1,6 +1,7 @@
package main

import (
gocontext "context"
"crypto/md5"
"encoding/json"
"fmt"
@@ -8,6 +9,7 @@ import (
"net/http"
"net/url"
"strings"
"time"

"bytes"

@@ -98,7 +100,8 @@ func discordFinish(c *gin.Context) {
return
}

tok, err := getDiscord().Exchange(nil, c.Query("code"))
reqCtx, _ := gocontext.WithTimeout(gocontext.Background(), time.Second*20)
tok, err := getDiscord().Exchange(reqCtx, c.Query("code"))
if err != nil {
c.Error(err)
addMessage(c, errorMessage{T(c, "An error occurred.")})

Loading…
Cancel
Save