Some checks failed
Deploy to production / deploy (push) Failing after 49s
- Created OAuth credentials setup guide for Google, Microsoft, Keycloak, ORY, and ZITADEL. - Added migration for oauth_identity table to store OAuth identities linked to users. - Implemented OAuthIdentity model for managing OAuth identities in the database. - Developed oauthService to handle OAuth login, user creation, and identity linking. - Created OAuthCallbackView and OAuthUserCallbackView components for handling OAuth responses in the frontend. - Added error handling and user feedback during the OAuth process.
54 lines
1.1 KiB
JavaScript
54 lines
1.1 KiB
JavaScript
import { sequelize } from '../../utils/sequelize.js';
|
|
import { DataTypes } from 'sequelize';
|
|
|
|
const OAuthIdentity = sequelize.define('oauth_identity', {
|
|
userId: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
field: 'user_id'
|
|
},
|
|
provider: {
|
|
type: DataTypes.STRING(64),
|
|
allowNull: false
|
|
},
|
|
issuer: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: false
|
|
},
|
|
subject: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: false
|
|
},
|
|
email: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: true
|
|
},
|
|
createdAt: {
|
|
type: DataTypes.DATE,
|
|
allowNull: false,
|
|
field: 'created_at',
|
|
defaultValue: DataTypes.NOW
|
|
},
|
|
updatedAt: {
|
|
type: DataTypes.DATE,
|
|
allowNull: false,
|
|
field: 'updated_at',
|
|
defaultValue: DataTypes.NOW
|
|
}
|
|
}, {
|
|
tableName: 'oauth_identity',
|
|
schema: 'community',
|
|
underscored: true,
|
|
timestamps: false,
|
|
indexes: [
|
|
{
|
|
unique: true,
|
|
fields: ['provider', 'subject']
|
|
},
|
|
{
|
|
fields: ['user_id']
|
|
}
|
|
]
|
|
});
|
|
|
|
export default OAuthIdentity; |