'Unknow column...' error
aldorac337 opened this issue · comments
trongthai commented
I tried to run an authentication example but has an error :
Error 1054: Unknown column 'basics.provider' in 'where clause' . Here is my source code:
import (
"github.com/qor/auth"
"github.com/qor/auth/auth_identity"
"github.com/qor/auth/providers/github"
"github.com/qor/auth/providers/google"
"github.com/qor/auth/providers/password"
"github.com/qor/auth/providers/facebook"
"github.com/qor/auth/providers/twitter"
"github.com/qor/session/manager"
"github.com/jinzhu/gorm”
)
var (
// Initialize gorm DB
gormDB, _ = gorm.Open("mysql", "root:123456@/qor_example?charset=utf8&parseTime=True&loc=Local")
// Initialize Auth with configuration
Auth = auth.New(&auth.Config{
DB: gormDB,
})
)
func init() {
// Migrate AuthIdentity model, AuthIdentity will be used to save auth info, like username/password, oauth token, you could change that.
gormDB.AutoMigrate(&auth_identity.AuthIdentity{})
// Register Auth providers
// Allow use username/password
Auth.RegisterProvider(password.New(&password.Config{}))
// Allow use Github
Auth.RegisterProvider(github.New(&github.Config{
ClientID: "github client id",
ClientSecret: "github client secret",
}))
// Allow use Google
Auth.RegisterProvider(google.New(&google.Config{
ClientID: "google client id",
ClientSecret: "google client secret",
}))
// Allow use Facebook
Auth.RegisterProvider(facebook.New(&facebook.Config{
ClientID: "facebook client id",
ClientSecret: "facebook client secret",
}))
// Allow use Twitter
Auth.RegisterProvider(twitter.New(&twitter.Config{
ClientID: "twitter client id",
ClientSecret: "twitter client secret",
}))
}
func main() {
mux := http.NewServeMux()
// Mount Auth to Router
mux.Handle("/auth/", Auth.NewServeMux())
http.ListenAndServe(":9000", manager.SessionManager.Middleware(mux))
}
Otto Barnes commented
+1. I get the same error.
Alexander Giesa commented
same here with
go 1.10.2
mysql and sqlite
Arink Verma commented
Is this fixed? I am also facing same issue.
sadegh-shahbazi commented
I have also same issue... in May 2019
It seems qor has been stopped
sadegh-shahbazi commented
qor-admin without auth is unusable
Márk Sági-Kazár commented
We faced this issue when upgraded GORM from v1.9.1 to v1.9.10. Downgrading back fixed the issue.