-
Good day Am sorry for asking this here, it seem this error is from jwt so gorm can't migrate the model. System specs
Am trying to AutoMigrate a claims model but i get the follwing error
it was working when i was using jwt.StandardClaims after i changed its not working any more, it migrates the user model first then it gets stuck on the claims model
Please help |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I was able to reproduce this. This is tricky, the error is produced because of the new type Beware, that storing any kind of credentials (and claims are credentials) on a database or other "persistent" storage is not a good idea in general, but that of course depends on your use case. |
Beta Was this translation helpful? Give feedback.
I was able to reproduce this. This is tricky, the error is produced because of the new type
jwt.ClaimsStrings
, which is necessary becauseaud
can either be a string or an array of strings (according to the JWT spec). This was incorrectly handled in our previous claims struct. The problem is, that the postgres driver cannot handle a structure which contains an array on its own. What I recommend would be to store the claims as a string rather than a struct in the database. Alternatively, there might be a way to configure/override the way gorm migrates the model using a custom function.Beware, that storing any kind of credentials (and claims are credentials) on a database or other "persiste…