Skip to content

Commit 1349488

Browse files
authored
Merge pull request #2 from ansrivas/as/migrate-to-v2
Fixes issue#1; migration to fiber-v2
2 parents 5e2e254 + a39bebf commit 1349488

File tree

6 files changed

+487
-156
lines changed

6 files changed

+487
-156
lines changed

README.md

Lines changed: 66 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -14,62 +14,62 @@ $ go get github.com/shareed2k/goth_fiber
1414

1515
## Supported Providers
1616

17-
* Amazon
18-
* Apple
19-
* Auth0
20-
* Azure AD
21-
* Battle.net
22-
* Bitbucket
23-
* Box
24-
* Cloud Foundry
25-
* Dailymotion
26-
* Deezer
27-
* Digital Ocean
28-
* Discord
29-
* Dropbox
30-
* Eve Online
31-
* Facebook
32-
* Fitbit
33-
* Gitea
34-
* GitHub
35-
* Gitlab
36-
* Google
37-
* Google+ (deprecated)
38-
* Heroku
39-
* InfluxCloud
40-
* Instagram
41-
* Intercom
42-
* Kakao
43-
* Lastfm
44-
* Linkedin
45-
* LINE
46-
* Mailru
47-
* Meetup
48-
* MicrosoftOnline
49-
* Naver
50-
* Nextcloud
51-
* OneDrive
52-
* OpenID Connect (auto discovery)
53-
* Paypal
54-
* SalesForce
55-
* Shopify
56-
* Slack
57-
* Soundcloud
58-
* Spotify
59-
* Steam
60-
* Strava
61-
* Stripe
62-
* Tumblr
63-
* Twitch
64-
* Twitter
65-
* Typetalk
66-
* Uber
67-
* VK
68-
* Wepay
69-
* Xero
70-
* Yahoo
71-
* Yammer
72-
* Yandex
17+
- Amazon
18+
- Apple
19+
- Auth0
20+
- Azure AD
21+
- Battle.net
22+
- Bitbucket
23+
- Box
24+
- Cloud Foundry
25+
- Dailymotion
26+
- Deezer
27+
- Digital Ocean
28+
- Discord
29+
- Dropbox
30+
- Eve Online
31+
- Facebook
32+
- Fitbit
33+
- Gitea
34+
- GitHub
35+
- Gitlab
36+
- Google
37+
- Google+ (deprecated)
38+
- Heroku
39+
- InfluxCloud
40+
- Instagram
41+
- Intercom
42+
- Kakao
43+
- Lastfm
44+
- Linkedin
45+
- LINE
46+
- Mailru
47+
- Meetup
48+
- MicrosoftOnline
49+
- Naver
50+
- Nextcloud
51+
- OneDrive
52+
- OpenID Connect (auto discovery)
53+
- Paypal
54+
- SalesForce
55+
- Shopify
56+
- Slack
57+
- Soundcloud
58+
- Spotify
59+
- Steam
60+
- Strava
61+
- Stripe
62+
- Tumblr
63+
- Twitch
64+
- Twitter
65+
- Typetalk
66+
- Uber
67+
- VK
68+
- Wepay
69+
- Xero
70+
- Yahoo
71+
- Yammer
72+
- Yandex
7373

7474
## Examples
7575

@@ -81,10 +81,19 @@ To run the example either clone the source from GitHub
8181
```text
8282
$ git clone git@github.com/shareed2k/goth_fiber.git
8383
```
84-
or use
84+
85+
or use for v2
86+
8587
```text
88+
$ go get github.com/shareed2k/goth_fiber/v2
89+
```
90+
91+
For v1
92+
93+
```
8694
$ go get github.com/shareed2k/goth_fiber
8795
```
96+
8897
```text
8998
$ cd goth_fiber/examples
9099
$ go get -v

examples/main.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ import (
44
"log"
55
"os"
66

7-
"github.com/gofiber/fiber"
7+
"github.com/gofiber/fiber/v2"
88
"github.com/markbates/goth"
99
"github.com/markbates/goth/providers/google"
10-
11-
"github.com/shareed2k/goth_fiber"
10+
"github.com/shareed2k/goth_fiber/v2"
1211
)
1312

1413
func main() {
@@ -17,26 +16,25 @@ func main() {
1716
goth.UseProviders(
1817
google.New(os.Getenv("OAUTH_KEY"), os.Getenv("OAUTH_SECRET"), "http://127.0.0.1:8088/auth/callback"),
1918
)
20-
2119
app.Get("/login", goth_fiber.BeginAuthHandler)
22-
app.Get("/auth/callback", func(ctx *fiber.Ctx) {
20+
app.Get("/auth/callback", func(ctx *fiber.Ctx) error {
2321
user, err := goth_fiber.CompleteUserAuth(ctx)
2422
if err != nil {
2523
log.Fatal(err)
2624
}
2725

28-
ctx.Send(user)
26+
return ctx.SendString(user.Email)
2927

3028
})
31-
app.Get("/logout", func(ctx *fiber.Ctx) {
29+
app.Get("/logout", func(ctx *fiber.Ctx) error {
3230
if err := goth_fiber.Logout(ctx); err != nil {
3331
log.Fatal(err)
3432
}
3533

36-
ctx.SendString("logout")
34+
return ctx.SendString("logout")
3735
})
3836

39-
if err := app.Listen(8088); err != nil {
37+
if err := app.Listen(":8088"); err != nil {
4038
log.Fatal(err)
4139
}
4240
}

go.mod

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
1-
module github.com/shareed2k/goth_fiber
1+
module github.com/shareed2k/goth_fiber/v2
22

3-
go 1.14
3+
go 1.15
44

55
require (
6-
github.com/gofiber/fiber v1.10.1
7-
github.com/gofiber/session v1.2.0
8-
github.com/markbates/goth v1.64.1
6+
github.com/andybalholm/brotli v1.0.1 // indirect
7+
github.com/gofiber/fiber/v2 v2.2.1
8+
github.com/golang/protobuf v1.4.3 // indirect
9+
github.com/gorilla/mux v1.7.3 // indirect
10+
github.com/klauspost/compress v1.11.3 // indirect
11+
github.com/kr/pretty v0.2.0 // indirect
12+
github.com/markbates/goth v1.66.0
13+
github.com/stretchr/testify v1.6.1 // indirect
14+
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b // indirect
15+
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58 // indirect
16+
golang.org/x/sys v0.0.0-20201126144705-a4b67b81d3d2 // indirect
17+
google.golang.org/appengine v1.6.7 // indirect
18+
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
19+
gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c // indirect
920
)

0 commit comments

Comments
 (0)