Skip to content

Commit

Permalink
i need to delete this branch then create a same one again (#35)
Browse files Browse the repository at this point in the history
* added google drive into scope

* edited go.mod

* edited go.mod

* finally?
  • Loading branch information
PeanutBrrutter authored Jul 20, 2024
1 parent f98c9a9 commit 1d0108d
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 116 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
edusync-7bd5e-firebase-adminsdk-x49uh-af084a6314.json
edusync-test-firebase-adminsdk-hk5kl-9af0162b09.json
.env
config.json
*.json
*.exe
Binary file modified EduSync.exe
Binary file not shown.
32 changes: 1 addition & 31 deletions authHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func AuthHandler(router *mux.Router, config *Config) {
}

gothic.Store = store
goth.UseProviders(google.New(config.GoogleClientID, config.GoogleClientSecret, "https://localhost:8080/auth/google/callback", "email", "profile"))
goth.UseProviders(google.New(config.GoogleClientID, config.GoogleClientSecret, "https://localhost:8080/auth/google/callback", "email", "profile", "https://www.googleapis.com/auth/drive.file"))

router.HandleFunc("/auth/{provider}/callback", func(res http.ResponseWriter, req *http.Request) {
user, err := gothic.CompleteUserAuth(res, req)
Expand All @@ -52,36 +52,6 @@ func AuthHandler(router *mux.Router, config *Config) {

// Only store the user object into the session if userRole is not an empty string
if userRole != "" {
// // Create a User object with the user role
// currentUser := User{
// GoogleID: user.UserID,
// Name: user.Name,
// Email: user.Email,
// ContactNumber: userObj.ContactNumber, // Use contact number from the retrieved user object
// Role: userObj.Role,
// CreatedAt: userObj.CreatedAt,
// UpdatedAt: userObj.UpdatedAt,
// }

// // Serialize the user object to JSON
// userData, err := json.Marshal(currentUser)
// if err != nil {
// http.Error(res, err.Error(), http.StatusInternalServerError)
// return
// }

// // Get the session and store the user data
// session, err := store.Get(req, "auth-session")
// if err != nil {
// http.Error(res, err.Error(), http.StatusInternalServerError)
// return
// }
// session.Values["user"] = userData
// err = session.Save(req, res)
// if err != nil {
// http.Error(res, err.Error(), http.StatusInternalServerError)
// return
// }

SetCurrentUser(res, req, userObj)

Expand Down
53 changes: 24 additions & 29 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,51 @@ module EduSync

go 1.22.3

require github.com/franela/goblin v0.0.0-20211003143422-0a4f594942bf
require (
firebase.google.com/go v3.13.0+incompatible
github.com/gorilla/mux v1.8.1
github.com/gorilla/sessions v1.3.0
github.com/joho/godotenv v1.5.1
github.com/markbates/goth v1.80.0
google.golang.org/api v0.188.0
)

require (
cloud.google.com/go v0.114.0 // indirect
cloud.google.com/go/auth v0.4.1 // indirect
cloud.google.com/go v0.115.0 // indirect
cloud.google.com/go/auth v0.7.0 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect
cloud.google.com/go/compute/metadata v0.3.0 // indirect
cloud.google.com/go/compute/metadata v0.4.0 // indirect
cloud.google.com/go/firestore v1.15.0 // indirect
cloud.google.com/go/iam v1.1.8 // indirect
cloud.google.com/go/longrunning v0.5.7 // indirect
cloud.google.com/go/iam v1.1.10 // indirect
cloud.google.com/go/longrunning v0.5.9 // indirect
cloud.google.com/go/storage v1.41.0 // indirect
firebase.google.com/go v3.13.0+incompatible // indirect
firebase.google.com/go/v4 v4.14.1 // indirect
github.com/MicahParks/keyfunc v1.9.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.4 // indirect
github.com/gorilla/context v1.1.2 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/gorilla/pat v1.0.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.5 // indirect
github.com/gorilla/securecookie v1.1.2 // indirect
github.com/gorilla/sessions v1.3.0 // indirect
github.com/joho/godotenv v1.5.1 // indirect
github.com/markbates/goth v1.80.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/oauth2 v0.20.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/api v0.181.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/appengine/v2 v2.0.2 // indirect
google.golang.org/genproto v0.0.0-20240401170217-c3f982113cda // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 // indirect
google.golang.org/grpc v1.63.2 // indirect
google.golang.org/protobuf v1.34.1 // indirect
google.golang.org/genproto v0.0.0-20240708141625-4ad9e859172b // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240708141625-4ad9e859172b // indirect
google.golang.org/grpc v1.64.1 // indirect
google.golang.org/protobuf v1.34.2 // indirect
)
Loading

0 comments on commit 1d0108d

Please sign in to comment.