Skip to content

Commit

Permalink
refactor: Update authentication and remove unnecessary imports
Browse files Browse the repository at this point in the history
- Replace ClientID, ClientSecret, and RedirectURL with actual values in module/gmail.go
- Remove `log` import, `godotenv` initialization, `log.Fatal` line, and `cors` import from main.go
- Change `zap` import to `go.uber.org/zap` in main.go
  • Loading branch information
ljshwyykl committed Jul 13, 2023
1 parent 1475746 commit 53c56fc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
9 changes: 0 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"encoding/base64"
"fmt"
"log"
"net/http"
"net/url"
"strings"
Expand All @@ -12,21 +11,13 @@ import (
"github.com/KNN3-Network/oauth-server/utils"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
"github.com/joho/godotenv"
"go.uber.org/zap"
)

var logger = utils.Logger

var stackoverflow = new(module.Stackoverflow)

func init() {
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
}
}

func main() {

r := gin.Default()
Expand Down
7 changes: 3 additions & 4 deletions module/gmail.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ func init() {
// log.Fatal("Error loading .env file")
// }
oauthConfig = &oauth2.Config{
ClientID: os.Getenv("GMAIL_ID"), // 替换为实际的客户端ID
ClientSecret: os.Getenv("GMAIL_SECRET"), // 替换为实际的客户端密钥
// RedirectURL: "https://knn3-gateway.knn3.xyz/oauth/gmail", // 替换为实际的回调URL
RedirectURL: "https://knn3-gateway.knn3.xyz/oauth/gmail", // 替换为实际的回调URL
ClientID: os.Getenv("GMAIL_ID"), // 替换为实际的客户端ID
ClientSecret: os.Getenv("GMAIL_SECRET"), // 替换为实际的客户端密钥
RedirectURL: "https://knn3-gateway.knn3.xyz/oauth/gmail", // 替换为实际的回调URL
Scopes: []string{
gmail.GmailReadonlyScope,
},
Expand Down

0 comments on commit 53c56fc

Please sign in to comment.