@@ -12,10 +12,10 @@ func main() {
12
12
g := goic .New ("/auth/o8" , true )
13
13
g .AddProvider (goic .Google .WithCredential (os .Getenv ("GOOGLE_CLIENT_ID" ), os .Getenv ("GOOGLE_CLIENT_SECRET" )))
14
14
g .AddProvider (goic .Microsoft .WithCredential (os .Getenv ("MICROSOFT_CLIENT_ID" ), os .Getenv ("MICROSOFT_CLIENT_SECRET" )))
15
+ g .AddProvider (goic .Yahoo .WithCredential (os .Getenv ("YAHOO_CLIENT_ID" ), os .Getenv ("YAHOO_CLIENT_SECRET" )))
15
16
16
17
g .UserCallback (func (t * goic.Token , u * goic.User , w http.ResponseWriter , r * http.Request ) {
17
- log .Println ("token: " , t )
18
- log .Println ("user: " , u )
18
+ log .Println ("token: " , t , "\n user: " , u )
19
19
_ , _ = w .Write ([]byte ("All good, check backend console" ))
20
20
})
21
21
@@ -24,9 +24,10 @@ func main() {
24
24
_ , _ = w .Write ([]byte (r .Method + " " + r .URL .Path ))
25
25
}
26
26
27
- log .Println ("Server running on https://localhost" )
28
- log .Println (" Visit https://localhost/auth/o8/google" )
29
- log .Println (" OR https://localhost/auth/o8/microsoft" )
27
+ log .Println ("Server running on https://localhost, You can visit any of the below URLs:" )
28
+ for _ , v := range []string {"google" , "microsoft" , "yahoo" } {
29
+ log .Printf (" https://localhost/auth/o8/%s\n " , v )
30
+ }
30
31
http .HandleFunc ("/" , g .MiddlewareFunc (handler ))
31
32
log .Fatal (http .ListenAndServeTLS (addr , "server.crt" , "server.key" , nil ))
32
33
}
0 commit comments