GithubHelp home page GithubHelp logo

buffalo-goth's Introduction

Buffalo Documentation

gobuffalo.io

This is the repository for https://www.gobuffalo.io, the official website of the Buffalo ecosystem.

This documentation contains:

Contributing

Contributing to this documentation site is a great, and easy, way to help make Buffalo better!

Note that this repository is only about Buffalo ecosystem documentation. If you want to contribute to the ecosystem itself, please refer to the concerned repository:

See the contribution guide for more info about how to contribute.

buffalo-goth's People

Contributors

lagorsse avatar maier-stefan avatar majorcode avatar markbates avatar paganotoni avatar patoui avatar piffio avatar robbyoconnor avatar sio4 avatar slomek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

buffalo-goth's Issues

could not find a matching session for this request

This happens at the oauth callback stage.

I've tested this for both facebook and gplus (the two providers that let me whitelist multiple callback urls)

These are functioning, fulling working oauth accounts that are used in production already (using omniauth)

Here is the oauth callback 'errortrace', doesn't look helpful

could not find a matching session for this request
github.com/markbates/pop.(*Connection).Transaction.func1
/home/kevin/go/src/github.com/markbates/pop/connection.go:122
github.com/markbates/pop.(*mysql).Lock
/home/kevin/go/src/github.com/markbates/pop/mysql.go:118
github.com/markbates/pop.(*Connection).Transaction
/home/kevin/go/src/github.com/markbates/pop/connection.go:109
github.com/gobuffalo/buffalo/middleware.glob..func1.1.1
/home/kevin/go/src/github.com/gobuffalo/buffalo/middleware/pop_transaction.go:22
github.com/gobuffalo/buffalo/middleware/csrf.glob..func1.1
/home/kevin/go/src/github.com/gobuffalo/buffalo/middleware/csrf/csrf.go:119
github.com/gobuffalo/buffalo/middleware.ParameterLogger.func1
/home/kevin/go/src/github.com/gobuffalo/buffalo/middleware/param_logger.go:28
github.com/gobuffalo/buffalo/middleware/ssl.ForceSSL.func1.1
/home/kevin/go/src/github.com/gobuffalo/buffalo/middleware/ssl/ssl.go:26
github.com/gobuffalo/buffalo.sessionSaver.func1
/home/kevin/go/src/github.com/gobuffalo/buffalo/session.go:70
github.com/gobuffalo/buffalo.RequestLoggerFunc.func1
/home/kevin/go/src/github.com/gobuffalo/buffalo/request_logger.go:51
github.com/gobuffalo/buffalo.(*App).PanicHandler.func1
/home/kevin/go/src/github.com/gobuffalo/buffalo/errors.go:69
github.com/gobuffalo/buffalo.RouteInfo.ServeHTTP
/home/kevin/go/src/github.com/gobuffalo/buffalo/handler.go:75
github.com/gobuffalo/buffalo.(*RouteInfo).ServeHTTP
<autogenerated>:1
github.com/gorilla/mux.(*Router).ServeHTTP
/home/kevin/go/src/github.com/gorilla/mux/mux.go:150
github.com/markbates/refresh/refresh/web.ErrorChecker.func1
/home/kevin/go/src/github.com/markbates/refresh/refresh/web/web.go:23
net/http.HandlerFunc.ServeHTTP
/usr/local/go/src/net/http/server.go:1918
github.com/gobuffalo/buffalo.(*App).ServeHTTP
/home/kevin/go/src/github.com/gobuffalo/buffalo/app.go:151
net/http.serverHandler.ServeHTTP
/usr/local/go/src/net/http/server.go:2619
net/http.(*conn).serve
/usr/local/go/src/net/http/server.go:1801
runtime.goexit
/usr/local/go/src/runtime/asm_amd64.s:2337
github.com/gobuffalo/buffalo.sessionSaver.func1
/home/kevin/go/src/github.com/gobuffalo/buffalo/session.go:72
github.com/gobuffalo/buffalo.RequestLoggerFunc.func1
/home/kevin/go/src/github.com/gobuffalo/buffalo/request_logger.go:51
github.com/gobuffalo/buffalo.(*App).PanicHandler.func1
/home/kevin/go/src/github.com/gobuffalo/buffalo/errors.go:69
github.com/gobuffalo/buffalo.RouteInfo.ServeHTTP
/home/kevin/go/src/github.com/gobuffalo/buffalo/handler.go:75
github.com/gobuffalo/buffalo.(*RouteInfo).ServeHTTP
<autogenerated>:1
github.com/gorilla/mux.(*Router).ServeHTTP
/home/kevin/go/src/github.com/gorilla/mux/mux.go:150
github.com/markbates/refresh/refresh/web.ErrorChecker.func1
/home/kevin/go/src/github.com/markbates/refresh/refresh/web/web.go:23
net/http.HandlerFunc.ServeHTTP
/usr/local/go/src/net/http/server.go:1918
github.com/gobuffalo/buffalo.(*App).ServeHTTP
/home/kevin/go/src/github.com/gobuffalo/buffalo/app.go:151
net/http.serverHandler.ServeHTTP
/usr/local/go/src/net/http/server.go:2619
net/http.(*conn).serve
/usr/local/go/src/net/http/server.go:1801
runtime.goexit
/usr/local/go/src/runtime/asm_amd64.s:2337

The error message comes from
github.com/markbates/goth/gothic/gothic.go

     func getSessionValue(session *sessions.Session, key string) (string, error) {                                       
       value := session.Values[key]                                                                                      
       if value == nil {                                                                                                 
         return "", fmt.Errorf("could not find a matching session for this request")                                     
       } 

I'm working my through understanding whats going on, but I have figured out that the 'key' should be either gplus or facebook, but its missing from the session at that point.

I'm still investigating. I'm new to golang so I'm using this as a chance to get familiar with debugging, but its going slowly.

BTW, we're going to have to put some warning on running this more than once, its destructive.

buffalo g goth x y z

Goth-Auth doesn't work

Hello! Thank you so much for your interest in Buffalo. The fact you care enough to be here, right now, helping, makes us very happy.

Description

I cannot get a new buffalo project working with goth-auth.

goth plugin

Steps to Reproduce the Problem

Following the buffalo tutorial for goth-auth, here is the steps to reproduce the failure:

brew install buffalo
buffalo new test
cd test
buffalo pop create -a
buffalo pop migrate
buffalo plugins install github.com/gobuffalo/buffalo-goth
buffalo generate goth-auth github
buffalo pop migrate
buffalo dev

Expected Behavior

At this point I would like to open my browser, navigate to the site, and authenticate via github.

Actual Behavior

First you get a bunch of undefined errors, comment out a bunch of stuff in the app and you'll get yourself a bit farther.

Then, add Host information to the buffalo.New command so github is happy.

Then, you will see this:

interface conversion: interface {} is *pop.Connection, not *pop.Connection (types from different packages)

Which I cannot seem to solve.

Info

Please run buffalo info and paste the information below where it says "PASTE_HERE".

$ buffalo info
-> Go: Checking installation
✓ The `go` executable was found on your system at: /usr/local/bin/go

-> Go: Checking minimum version requirements
✓ Your version of Go, 1.14.2, meets the minimum requirements.

-> Go: Checking Package Management
✓ You are using Go Modules (`go`) for package management.

-> Go: Checking PATH
✓ Your PATH contains /Users/thomas/go/bin.

-> Node: Checking installation
✓ The `node` executable was found on your system at: /Users/thomas/.nvm/versions/node/v10.15.3/bin/node

-> Node: Checking minimum version requirements
✓ Your version of Node, v10.15.3, meets the minimum requirements.

-> NPM: Checking installation
✓ The `npm` executable was found on your system at: /Users/thomas/.nvm/versions/node/v10.15.3/bin/npm

-> NPM: Checking minimum version requirements
✓ Your version of NPM, 6.4.1, meets the minimum requirements.

-> Yarn: Checking installation
✓ The `yarnpkg` executable was found on your system at: /Users/thomas/.nvm/versions/node/v10.15.3/bin/yarnpkg

-> Yarn: Checking minimum version requirements
✓ Your version of Yarn, 1.19.2, meets the minimum requirements.

-> PostgreSQL: Checking installation
✓ The `postgres` executable was found on your system at: /opt/local/bin/postgres

-> PostgreSQL: Checking minimum version requirements
✓ Your version of PostgreSQL, 10.11.0, meets the minimum requirements.

-> MySQL: Checking installation
✘ The `mysql` executable could not be found on your system.
For help setting up your MySQL environment please follow the instructions for you platform at:

https://www.mysql.com/downloads/

-> SQLite3: Checking installation
✓ The `sqlite3` executable was found on your system at: /opt/local/bin/sqlite3

-> SQLite3: Checking minimum version requirements
✓ Your version of SQLite3, 3.31.1, meets the minimum requirements.

-> Cockroach: Checking installation
✘ The `cockroach` executable could not be found on your system.
For help setting up your Cockroach environment please follow the instructions for you platform at:

https://www.cockroachlabs.com/docs/stable/

-> Buffalo (CLI): Checking installation
✓ The `buffalo` executable was found on your system at: /usr/local/bin/buffalo

-> Buffalo (CLI): Checking minimum version requirements
✓ Your version of Buffalo (CLI), v0.16.8, meets the minimum requirements.

-> Buffalo: Application Details
Pwd         /Users/thomas/Scratch/orda
Root        /Users/thomas/Scratch/orda
GoPath      /Users/thomas/go
PackagePkg  orda
ActionsPkg  orda/actions
ModelsPkg   orda/models
GriftsPkg   orda/grifts
WithModules true
Name        orda
Bin         bin/orda
VCS         git
WithPop     true
WithSQLite  false
WithDep     false
WithWebpack true
WithNodeJs  true
WithYarn    true
WithDocker  true
WithGrifts  true
AsWeb       true
AsAPI       false
InApp       true
PackageJSON {map[build:webpack -p --progress dev:webpack --watch]}

-> Buffalo: config/buffalo-app.toml
name = "orda"
bin = "bin/orda"
vcs = "git"
with_pop = true
with_sqlite = false
with_dep = false
with_webpack = true
with_nodejs = true
with_yarn = true
with_docker = true
with_grifts = true
as_web = true
as_api = false

-> Buffalo: config/buffalo-plugins.toml
[[plugin]]
  binary = "buffalo-goth"
  go_get = "github.com/gobuffalo/buffalo-goth"

[[plugin]]
  binary = "buffalo-pop"
  go_get = "github.com/gobuffalo/buffalo-pop/v2"

-> Buffalo: go.mod
module orda

go 1.14

require (
        github.com/gobuffalo/buffalo v0.15.5
        github.com/gobuffalo/buffalo-goth v1.3.0 // indirect
        github.com/gobuffalo/buffalo-pop/v2 v2.0.6
        github.com/gobuffalo/envy v1.9.0
        github.com/gobuffalo/mw-csrf v0.0.0-20190129204204-25460a055517
        github.com/gobuffalo/mw-forcessl v0.0.0-20180802152810-73921ae7a130
        github.com/gobuffalo/mw-i18n v0.0.0-20190129204410-552713a3ebb4
        github.com/gobuffalo/mw-paramlogger v0.0.0-20190129202837-395da1998525
        github.com/gobuffalo/nulls v0.2.0
        github.com/gobuffalo/packr/v2 v2.8.0
        github.com/gobuffalo/pop v4.13.1+incompatible
        github.com/gobuffalo/pop/v5 v5.1.1
        github.com/gobuffalo/suite v2.8.2+incompatible
        github.com/gobuffalo/validate/v3 v3.1.0
        github.com/gofrs/uuid v3.2.0+incompatible
        github.com/markbates/goth v1.64.1
        github.com/unrolled/secure v0.0.0-20190103195806-76e6d4e9b90c
)

Failed to: go get -u github.com/gobuffalo/buffalo-goth

Hi,

I'm following the "Third Party Authentication" video tutorial here: https://gobuffalo.io/en/docs/goth/
and ran into some issues, which I was able to resolve:

go version go1.12.5 linux/amd64
buffalo v0.14.8
GO111MODULE=on

The first issue is the documentation is out of date, it seems the correct approach (for those of us using go modules) is:

Leave your buffalo project directory

cd ../

Add buffalo-goth to $GOPATH

go get -u github.com/gobuffalo/buffalo-goth

Go back into your buffalo project directory

cd -

Install the buffalo-goth plugin (project scope)

buffalo plugins install github.com/gobuffalo/buffalo-goth

Enjoy a working generator

buffalo generate goth google twitter facebook

However, the go get -u github.com/gobuffalo/buffalo-goth step has the following error.

go: github.com/golang/[email protected]: parsing go.mod: unexpected module path "golang.org/x/lint"
go: sourcegraph.com/sourcegraph/[email protected]: parsing go.mod: unexpected module path "github.com/sourcegraph/go-diff"

To work around this problem, I took this approach instead:

cd ../
go get -u github.com/gobuffalo/buffalo-goth
go get -u github.com/sourcegraph/go-diff/diff
go get github.com/gobuffalo/buffalo-goth # <-- Working because this is a fresh install
cd -
buffalo plugins install github.com/gobuffalo/buffalo-goth
buffalo generate goth google twitter facebook

And everything seems ok.

I am a big fan of what buffalo is trying to achieve and would love to help out as much as I can. If someone would like to point me in the right direction, I would like to:

  1. Resolve the go module issue (not sure which package is the culprit?)
  2. Update the documentation here with the correct approach for both with and without GO111MODULE=on

buffalo g goth-auth fails when trying to write out to the actions/app.go file

$ b g goth-auth github
INFO[0000] /home/rob/gocode/src/github.com/robbyoconnor/golangnyc_cfp_aug23/actions/auth.go 
INFO[0000] /home/rob/gocode/src/github.com/robbyoconnor/golangnyc_cfp_aug23/actions/app.go 
INFO[0000] go get github.com/markbates/goth/...         
INFO[0002] /home/rob/gocode/src/github.com/robbyoconnor/golangnyc_cfp_aug23/actions/auth.go 
INFO[0002] buffalo db generate model user name email:nulls.String provider provider_id 
v4.6.8

      create  models/user.go
      create  models/user_test.go
         run  goimports -w actions/actions_test.go actions/app.go actions/auth.go actions/home.go actions/home_test.go actions/render.go grifts/db.go grifts/init.go main.go models/models.go models/models_test.go models/user.go models/user_test.go
      create  migrations/20180823041815_create_users.up.fizz
      create  migrations/20180823041815_create_users.down.fizz
INFO[0002] /home/rob/gocode/src/github.com/robbyoconnor/golangnyc_cfp_aug23/actions/app.go 
Error: /home/rob/gocode/src/github.com/robbyoconnor/golangnyc_cfp_aug23/actions/app.go:1:2: expected 'package', found 'EOF'
Usage:
  buffalo-goth goth-auth [flags]

Flags:
  -d, --dry-run   run the generator without creating files or running commands
  -h, --help      help for goth-auth

/home/rob/gocode/src/github.com/robbyoconnor/golangnyc_cfp_aug23/actions/app.go:1:2: expected 'package', found 'EOF'
Usage:
  buffalo generate goth-auth [flags]

Flags:
  -h, --help   help for goth-auth

ERRO[0004] Error: exit status 1

It seems to be clobbering the actions/app.go file and then failing...

Buffalo is returning `Error: could not find desired block in actions/app.go` instead of adding goth-auth lines to app

Description

Buffalo is returning Error: could not find desired block in actions/app.go instead of adding goth-auth lines to app

Expected Behavior

Adding auth lines to actions/app.go

Actual Behavior

Error: could not find desired block in actions/app.go
Usage:
  buffalo-goth goth-auth [flags]

Flags:
  -d, --dry-run   run the generator without creating files or running commands
  -h, --help      help for goth-auth

could not find desired block in actions/app.go
Usage:
  buffalo generate goth-auth [flags]

Flags:
  -h, --help   help for goth-auth

ERRO[0000] Error: exit status 1

To Reproduce

wget https://github.com/gobuffalo/cli/releases/download/v0.18.12/buffalo_0.18.12_Linux_x86_64.tar.gz\ntar -xvzf buffalo_0.18.12_Linux_x86_64.tar.gz\nsudo mv buffalo /usr/local/bin/buffalo
buffalo new --db-type mysql --ci-provider gitlab-ci project
cd project/
buffalo plugins install github.com/gobuffalo/buffalo-goth
buffalo g  goth-auth google facebook

Additional Context

Details

buffalo info   
-> Go: Checking installation
✓ The `go` executable was found on your system at: /usr/local/go/bin/go

-> Go: Checking minimum version requirements
✓ Your version of Go, 1.19.4, meets the minimum requirements.

-> Go: Checking Package Management
✓ You are using Go Modules (`go`) for package management.

-> Go: Checking PATH
✓ Your PATH contains /home/niko/go/bin.

-> Node: Checking installation
✓ The `node` executable was found on your system at: /usr/local/bin/node

-> Node: Checking minimum version requirements
✓ Your version of Node, v18.12.0, meets the minimum requirements.

-> NPM: Checking installation
✓ The `npm` executable was found on your system at: /usr/local/bin/npm

-> NPM: Checking minimum version requirements
✓ Your version of NPM, 8.19.2, meets the minimum requirements.

-> Yarn: Checking installation
✓ The `yarnpkg` executable was found on your system at: /usr/local/bin/yarnpkg

-> Yarn: Checking minimum version requirements
✓ Your version of Yarn, 3.3.1, meets the minimum requirements.

-> PostgreSQL: Checking installation
✘ The `postgres` executable could not be found on your system.
For help setting up your Postgres environment please follow the instructions for you platform at:

https://www.postgresql.org/download/

-> MySQL: Checking installation
✓ The `mysql` executable was found on your system at: /usr/bin/mysql

-> MySQL: Checking minimum version requirements
✓ Your version of MySQL, 8.0.31, meets the minimum requirements.

-> SQLite3: Checking installation
✘ The `sqlite3` executable could not be found on your system.
For help setting up your SQLite3 environment please follow the instructions for you platform at:

https://www.sqlite.org/download.html

-> Cockroach: Checking installation
✘ The `cockroach` executable could not be found on your system.
For help setting up your Cockroach environment please follow the instructions for you platform at:

https://www.cockroachlabs.com/docs/stable/

-> Buffalo (CLI): Checking installation
✓ The `buffalo` executable was found on your system at: /usr/local/bin/buffalo

-> Buffalo (CLI): Checking minimum version requirements
✓ Your version of Buffalo (CLI), v0.18.12, meets the minimum requirements.

-> Buffalo: Application Details
Pwd         /home/niko/code/src/gitlab.com/nicolebroyak/project
Root        /home/niko/code/src/gitlab.com/nicolebroyak/project
GoPath      /home/niko/go
PackagePkg  project
ActionsPkg  project/actions
ModelsPkg   project/models
GriftsPkg   project/grifts
WithModules true
Name        project
Bin         bin/project
VCS         git
WithPop     true
WithSQLite  false
WithDep     false
WithWebpack true
WithNodeJs  true
WithYarn    true
WithDocker  true
WithGrifts  true
AsWeb       true
AsAPI       false
InApp       true
PackageJSON {map[build:webpack --mode production --progress dev:webpack --watch]}

-> Buffalo: config/buffalo-app.toml
name = "project"
bin = "bin/project"
vcs = "git"
with_pop = true
with_sqlite = false
with_dep = false
with_webpack = true
with_nodejs = true
with_yarn = true
with_docker = true
with_grifts = true
as_web = true
as_api = false

-> Buffalo: config/buffalo-plugins.toml
[[plugin]]
  binary = "buffalo-goth"
  go_get = "github.com/gobuffalo/buffalo-goth@latest"

[[plugin]]
  binary = "buffalo-pop"
  go_get = "github.com/gobuffalo/buffalo-pop/v3@latest"

-> Buffalo: go.mod
module project

go 1.18

require (
	github.com/gobuffalo/buffalo v1.0.1
	github.com/gobuffalo/buffalo-pop/v3 v3.0.6
	github.com/gobuffalo/envy v1.10.2
	github.com/gobuffalo/grift v1.5.2
	github.com/gobuffalo/mw-csrf v1.0.1
	github.com/gobuffalo/mw-forcessl v1.0.1
	github.com/gobuffalo/mw-i18n/v2 v2.0.2
	github.com/gobuffalo/mw-paramlogger v1.0.1
	github.com/gobuffalo/pop/v6 v6.1.0
	github.com/gobuffalo/suite/v4 v4.0.3
	github.com/unrolled/secure v1.13.0
)

require (
	github.com/BurntSushi/toml v1.2.1 // indirect
	github.com/Masterminds/semver/v3 v3.1.1 // indirect
	github.com/aymerick/douceur v0.2.0 // indirect
	github.com/davecgh/go-spew v1.1.1 // indirect
	github.com/dustin/go-humanize v1.0.0 // indirect
	github.com/fatih/color v1.13.0 // indirect
	github.com/fatih/structs v1.1.0 // indirect
	github.com/felixge/httpsnoop v1.0.1 // indirect
	github.com/fsnotify/fsnotify v1.5.4 // indirect
	github.com/go-sql-driver/mysql v1.6.0 // indirect
	github.com/gobuffalo/buffalo-goth v1.4.0 // indirect
	github.com/gobuffalo/events v1.4.3 // indirect
	github.com/gobuffalo/fizz v1.14.4 // indirect
	github.com/gobuffalo/flect v0.3.0 // indirect
	github.com/gobuffalo/genny/v2 v2.1.0 // indirect
	github.com/gobuffalo/github_flavored_markdown v1.1.3 // indirect
	github.com/gobuffalo/helpers v0.6.7 // indirect
	github.com/gobuffalo/httptest v1.5.2 // indirect
	github.com/gobuffalo/logger v1.0.7 // indirect
	github.com/gobuffalo/meta v0.3.3 // indirect
	github.com/gobuffalo/nulls v0.4.2 // indirect
	github.com/gobuffalo/packd v1.0.2 // indirect
	github.com/gobuffalo/plush/v4 v4.1.16 // indirect
	github.com/gobuffalo/refresh v1.13.2 // indirect
	github.com/gobuffalo/tags/v3 v3.1.4 // indirect
	github.com/gobuffalo/validate/v3 v3.3.3 // indirect
	github.com/gofrs/uuid v4.3.1+incompatible // indirect
	github.com/golang/protobuf v1.4.2 // indirect
	github.com/gorilla/css v1.0.0 // indirect
	github.com/gorilla/handlers v1.5.1 // indirect
	github.com/gorilla/mux v1.8.0 // indirect
	github.com/gorilla/securecookie v1.1.1 // indirect
	github.com/gorilla/sessions v1.2.1 // indirect
	github.com/inconshreveable/mousetrap v1.1.0 // indirect
	github.com/jackc/chunkreader/v2 v2.0.1 // indirect
	github.com/jackc/pgconn v1.13.0 // indirect
	github.com/jackc/pgio v1.0.0 // indirect
	github.com/jackc/pgpassfile v1.0.0 // indirect
	github.com/jackc/pgproto3/v2 v2.3.1 // indirect
	github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
	github.com/jackc/pgtype v1.12.0 // indirect
	github.com/jackc/pgx/v4 v4.17.2 // indirect
	github.com/jmoiron/sqlx v1.3.5 // indirect
	github.com/joho/godotenv v1.4.0 // indirect
	github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
	github.com/luna-duclos/instrumentedsql v1.1.3 // indirect
	github.com/markbates/goth v1.75.2 // indirect
	github.com/mattn/go-colorable v0.1.9 // indirect
	github.com/mattn/go-isatty v0.0.14 // indirect
	github.com/mattn/go-sqlite3 v1.14.16 // indirect
	github.com/microcosm-cc/bluemonday v1.0.20 // indirect
	github.com/mitchellh/go-homedir v1.1.0 // indirect
	github.com/monoculum/formam v3.5.5+incompatible // indirect
	github.com/nicksnyder/go-i18n v1.10.1 // indirect
	github.com/pelletier/go-toml v1.2.0 // indirect
	github.com/pkg/errors v0.9.1 // indirect
	github.com/pmezard/go-difflib v1.0.0 // indirect
	github.com/rogpeppe/go-internal v1.9.0 // indirect
	github.com/sergi/go-diff v1.2.0 // indirect
	github.com/sirupsen/logrus v1.9.0 // indirect
	github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d // indirect
	github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e // indirect
	github.com/spf13/cobra v1.6.1 // indirect
	github.com/spf13/pflag v1.0.5 // indirect
	github.com/stretchr/testify v1.8.1 // indirect
	golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect
	golang.org/x/mod v0.7.0 // indirect
	golang.org/x/net v0.3.0 // indirect
	golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43 // indirect
	golang.org/x/sync v0.1.0 // indirect
	golang.org/x/sys v0.3.0 // indirect
	golang.org/x/term v0.3.0 // indirect
	golang.org/x/text v0.5.0 // indirect
	golang.org/x/tools v0.4.0 // indirect
	google.golang.org/appengine v1.6.6 // indirect
	google.golang.org/protobuf v1.25.0 // indirect
	gopkg.in/yaml.v2 v2.4.0 // indirect
	gopkg.in/yaml.v3 v3.0.1 // indirect
)

The "goth-auth" generator is applying the auth.go "goth" template instead

Steps to reproduce (any provider works):

buffalo generate goth-auth github

The app fails to compile.

The generated auth.go file does not have the required methods (added in app.go):

func AuthCallback(c buffalo.Context) error {} // This is only partially implemented, using the simple "goth" template instead
func AuthDestroy(c buffalo.Context) error {}
func SetCurrentUser(next buffalo.Handler) buffalo.Handler {}
func Authorize(next buffalo.Handler) buffalo.Handler {}

Invalid provider declaration for Auth0

When generating Auth0 provider authentication on the init block inside auth.go, this generator is using an invalid signature to initialize the auth0 provider (requires more arguments):

...
goth.UseProviders(
    auth0.New(os.Getenv("AUTH0_KEY"), os.Getenv("AUTH0_SECRET"), fmt.Sprintf("%s%s", App().Host, "/auth/auth0/callback")),
)

This ends up not compiling and should be:

goth.UseProviders(
    auth0.New(os.Getenv("AUTH0_KEY"), os.Getenv("AUTH0_SECRET"), fmt.Sprintf("%s%s", App().Host, "/auth/auth0/callback"), os.Getenv("AUTH0_DOMAIN"), os.Getenv("AUTH0_SCOPE")),
)

Wrong pop package import in goth-auth template

When trying to setup a new project with buffalo and github authentication I stumbled upon the following issue.

First of all, these are the steps I followed:

I set up a simple project as follows

$ buffalo new goth-auth
[...]
$ cd goth_auth/
$ buffalo db create --all

Then I tried to add github authentication using the goth-auth capability:

$ buffalo generate goth-auth github
INFO[0000] Find is deprecated, and will be removed in v0.12.0. Use generators.FindByBox instead. Called from /home/piffio/src/github.com/gobuffalo/buffalo-goth/auth/auth.go:14
      create  actions/auth.go
      create  actions/auth_test.go
         run  buffalo db generate model user name email:nulls.String provider provider_id
v4.1.0

      create  models/user.go
      create  models/user_test.go
         run  goimports -w actions/actions_test.go actions/app.go actions/auth.go actions/auth_test.go actions/home.go actions/home_test.go actions/render.go grifts/db.go grifts/init.go main.go models/models.go models/models_test.go models/user.go models/user_test.go
> migrations/20180311214330_create_users.up.fizz
> migrations/20180311214330_create_users.down.fizz
         run  go get github.com/markbates/goth/...
]$ buffalo dev
buffalo: 2018/03/11 22:44:02 === Rebuild on: :start: ===
buffalo: 2018/03/11 22:44:02 === Running: go build -v -i -o tmp/goth-auth-build  (PID: 8650) ===
github.com/piffio/goth_auth/actions
# github.com/piffio/goth_auth/actions
actions/auth.go:46:10: cannot use "github.com/markbates/pop/nulls".NewString(gu.Email) (type "github.com/markbates/pop/nulls".String) as type "github.com/gobuffalo/pop/nulls".String in assignment
buffalo: 2018/03/11 22:44:02 === Error! ===
buffalo: 2018/03/11 22:44:02 === exit status 2
github.com/piffio/goth_auth/actions
# github.com/piffio/goth_auth/actions
actions/auth.go:46:10: cannot use "github.com/markbates/pop/nulls".NewString(gu.Email) (type "github.com/markbates/pop/nulls".String) as type "github.com/gobuffalo/pop/nulls".String in assignment

This is caused by the fact that buffalo and buffalo-goth are using different signatures for the pop package, as follows:

$  grep -r "markbates\/pop" *
actions/auth.go:        "github.com/markbates/pop"
actions/auth.go:        "github.com/markbates/pop/nulls"
actions/auth_test.go:   "github.com/markbates/pop/nulls"
$  grep -r "gobuffalo\/pop" *
models/models.go:       "github.com/gobuffalo/pop"
models/user.go: "github.com/gobuffalo/pop"
models/user.go: "github.com/gobuffalo/pop/nulls"

The issue seems to be in the file auth/templates/actions/auth.go.tmpl.

I will be attaching a pull request after testing the fix

interface conversion issue

currently seeing:

interface conversion: interface {} is *pop.Connection, not *pop.Connection (types from different packages)

when trying to use authentication generated via buffalo generate goth-auth github

any ideas?

undefined errors

currently seeing undefined errors after running goth-auth github

$ buffalo generate goth-auth github
$ buffalo dev
=== exit status 2
orda/actions
# orda/actions
actions/app.go:67:11: undefined: SetCurrentUser
actions/app.go:68:11: undefined: Authorize
actions/app.go:69:23: undefined: Authorize
actions/app.go:72:19: undefined: AuthDestroy
actions/app.go:73:24: undefined: Authorize
 ===

I have run

$ go get -u github.com/gobuffalo/buffalo-goth 
$ buffalo plugins install github.com/gobuffalo/buffalo-goth

buffalo generate doesn't find goth in app directory

When I run buffalo g goth twitter in my buffalo app directory the standard help text for the generate function comes up. Like it doesn't recognise the goth package.
However if i run it in my src directory, it works succesfully (Tries opening the actions/app.go file, but fails obviously because it cant find it).
I have checked, rechecked and triple checked my GOPATH and PATH and everything is setup correctly.
I have "go get" the gobuffalo/buffalo-goth package and it is in the right place.
Screenshot 2019-04-09 at 12 48 06

Fail to resolve dependency github.com/gobuffalo/genny/movinglater/gotools

Unable to install goth. Dependency github.com/gobuffalo/genny/movinglater/gotools not found.

To verify I created a clean $GOPATH directory:

$ mv "${GOPATH}" "${GOPATH}.bak"
$ mkdir "${GOPATH}" 
$ go get -u github.com/gobuffalo/buffalo-goth
package github.com/gobuffalo/genny/movinglater/gotools: cannot find package "github.com/gobuffalo/genny/movinglater/gotools" in any of:
        /usr/local/go/src/github.com/gobuffalo/genny/movinglater/gotools (from $GOROOT)
        /home/lance/go/src/github.com/gobuffalo/genny/movinglater/gotools (from $GOPATH)
package github.com/gobuffalo/genny/movinglater/gotools/gomods: cannot find package "github.com/gobuffalo/genny/movinglater/gotools/gomods" in any of:
        /usr/local/go/src/github.com/gobuffalo/genny/movinglater/gotools/gomods (from $GOROOT)
        /home/lance/go/src/github.com/gobuffalo/genny/movinglater/gotools/gomods (from $GOPATH)

If you want, let me know where the "movinglater" packaged moved to, and I fix and submit a PR.

Unable to install plugins on M1 - issue with golang 1.18 - golang.org/x/sys/unix

Description

Inability to install buffalo plugins via the buffalo plugins install command.

Steps to reproduce

Try installing any plugin via the cli. For eg.:

  1. buffalo plugins install github.com/gobuffalo/buffalo-auth
  2. buffalo plugins install github.com/gobuffalo/buffalo-goth

Expected Behaviour

Installs the respective plugin.

Actual Behaviour

Getting the following error message:

# golang.org/x/sys/unix
../../go/pkg/mod/golang.org/x/[email protected]/unix/syscall_darwin.1_13.go:25:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.1_13.go:27:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.1_13.go:40:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:28:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:43:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:59:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:75:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:90:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:105:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:121:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:121:3: too many errors
Usage:
  buffalo plugins install [flags]

Flags:
  -d, --dry-run   dry run
  -h, --help      help for install
      --vendor    will install plugin binaries into ./plugins [WINDOWS not currently supported]
  -v, --verbose   turn on verbose logging

ERRO[0000] Error: exit status 2            

System Information

Installed plugin support using: go get -u -v github.com/gobuffalo/buffalo-plugins
Buffalo Version: 0.18.5
Go Version: 1.18.2 darwin/arm64

Dirty Fix

The fix as per offical golang docs is to run go get -u golang.org/x/sys to upgrade golang.org/x/sys however that isn't working for the Buffalo CLI because it seems to be relying on the old version of golang.org/x/sys (Version: @v0.0.0-20200124204421-9fbb57f87de9) as seen from the above error message. As a quick fix I just renamed the [email protected] folder to [email protected] (the latest version) and it worked.

undefined: oauth2.RegisterBrokenAuthHeaderProvider

$ go get -u github.com/gobuffalo/buffalo-goth
$ buffalo g goth github
      create  actions/auth.go
         run  go get github.com/markbates/goth/...
# github.com/markbates/goth/providers/wepay
../github.com/markbates/goth/providers/wepay/session.go:33:2: undefined: oauth2.RegisterBrokenAuthHeaderProvider
Error: exit status 2

$ buffalo g goth cloudfoundry
      create  actions/auth.go
         run  go get github.com/markbates/goth/...
# github.com/markbates/goth/providers/wepay
../github.com/markbates/goth/providers/wepay/session.go:33:2: undefined: oauth2.RegisterBrokenAuthHeaderProvider
Error: exit status 2

Using gobuffalo 12

Using the old version of pop

buffalo-goth and buffalo-auth are still using the old version of pop: github.com/markbates/pop instead of github.com/gobuffalo/pop the easiest PR is to simply replace the templates.

A better approach is just to scan the models directory looking for either one of the imports. The first one you find wins and that’s what is printed.

I'll try to fix it soon.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.