matryer / goblueprints

Source code for Go Programming Blueprints
1.48k stars 356 forks source link

In chapter 2, callback URL of "provider".New() shouldn't fix the port. #31

Closed entyo closed 8 years ago

entyo commented 8 years ago

In chapter 2, PROVIDER.New() (github, facebook, etc) has a parameter which specifies the callback URL. (https://github.com/matryer/goblueprints/blob/master/chapter2/chat/main.go#L51)

    gomniauth.WithProviders(
        github.New("3d1e6ba69036e0624b61", "7e8938928d802e7582908a5eadaaaf22d64babf1", "http://localhost:8080/auth/callback/github"),
        google.New("44166123467-o6brs9o43tgaek9q12lef07bk48m3jmf.apps.googleusercontent.com", "rpXpakthfjPVoFGvcf9CVCu7", "http://localhost:8080/auth/callback/google"),
        facebook.New("537611606322077", "f9f4d77b3d3f4f5775369f5c9f88f65e", "http://localhost:8080/auth/callback/facebook"),
    )

These URLs fix port. But we use the command line parameter to specify it, so it mustn't be fixed. I think URLs should be as below.

"http://localhost:" + *host + "/auth/callback/facebook"
matryer commented 8 years ago

Thanks - you're right. Most of this code is illustrative based on the chapters, and I didn't want to overload people with concepts, but this would be a good way to do this.

On 7 Jun 2016, at 05:25, entyo notifications@github.com wrote:

In chapter 2, PROVIDER.New() (github, facebook, etc) has a parameter which specifies the callback URL. (https://github.com/matryer/goblueprints/blob/master/chapter2/chat/main.go#L51)

gomniauth.WithProviders( github.New("3d1e6ba69036e0624b61", "7e8938928d802e7582908a5eadaaaf22d64babf1", "http://localhost:8080/auth/callback/github"), google.New("44166123467-o6brs9o43tgaek9q12lef07bk48m3jmf.apps.googleusercontent.com", "rpXpakthfjPVoFGvcf9CVCu7", "http://localhost:8080/auth/callback/google"), facebook.New("537611606322077", "f9f4d77b3d3f4f5775369f5c9f88f65e", "http://localhost:8080/auth/callback/facebook"), ) These URLs fix port. But we use the command line parameter to specify it, so it mustn't be fixed. I think URLs should be as below.

"http://localhost:" + *host + "/auth/callback/facebook" — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

entyo commented 8 years ago

I see. Thank you for your kind.