pyramid_oauth2_provider
pyramid_oauth2_provider copied to clipboard
Mysql dialect Support
The Oauth2Client model use the following definition
_client_secret = Column(Binary(255), unique=True, nullable=False)
On db initialization, the following error is raised
OperationalError: (_mysql_exceptions.OperationalError) (1170, "BLOB/TEXT column '_client_secret' used in key specification without a key length") [SQL: u'\nCREATE TABLE oidc_client (\n\tid INTEGER NOT NULL AUTO_INCREMENT, \n\tclient_id VARCHAR(64) NOT NULL, \n\t_client_secret BLOB(255) NOT NULL, \n\trevoked BOOL, \n\trevocation_date DATETIME, \n\tCONSTRAINT pk_oidc_client PRIMARY KEY (id), \n\tCONSTRAINT test UNIQUE (_client_secret), \n\tCONSTRAINT uq_oidc_client_client_id UNIQUE (client_id), \n\tCONSTRAINT ck_oidc_client_revoked CHECK (revoked IN (0, 1))\n)ENGINE=InnoDB CHARSET=utf8\n\n']
setting the column type to sqlalchemy.dialects.mysql.BINARY works as expected (but it's not a satisfying solution).
I believe I need to remove unique=True on this, which won't be a problem for this column. Will work on this later today.
Removing unique=true from the column worked in my tests. Please try on your end, and I will submit a PR for it.
Just for reference...this is ok to remove since it is an encrypted field, and a password tied to a unique client_id, so uniqueness does not matter.
The issue was related to MySQL limitation on indexing size.
Yes it's an indexing problem, removing it should do the trick
@elliotpeele Any update on merging #21?