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.
70 lines
1.8 KiB
JavaScript
70 lines
1.8 KiB
JavaScript
'use strict';
|
|
|
|
/** @type {import('sequelize-cli').Migration} */
|
|
module.exports = {
|
|
async up(queryInterface, Sequelize) {
|
|
await queryInterface.createTable(
|
|
{ schema: 'community', tableName: 'oauth_identity' },
|
|
{
|
|
id: {
|
|
type: Sequelize.INTEGER,
|
|
primaryKey: true,
|
|
autoIncrement: true,
|
|
allowNull: false,
|
|
},
|
|
user_id: {
|
|
type: Sequelize.INTEGER,
|
|
allowNull: false,
|
|
references: {
|
|
model: { schema: 'community', tableName: 'user' },
|
|
key: 'id',
|
|
},
|
|
onUpdate: 'CASCADE',
|
|
onDelete: 'CASCADE',
|
|
},
|
|
provider: {
|
|
type: Sequelize.STRING(64),
|
|
allowNull: false,
|
|
},
|
|
issuer: {
|
|
type: Sequelize.TEXT,
|
|
allowNull: false,
|
|
},
|
|
subject: {
|
|
type: Sequelize.TEXT,
|
|
allowNull: false,
|
|
},
|
|
email: {
|
|
type: Sequelize.TEXT,
|
|
allowNull: true,
|
|
},
|
|
created_at: {
|
|
type: Sequelize.DATE,
|
|
allowNull: false,
|
|
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
|
|
},
|
|
updated_at: {
|
|
type: Sequelize.DATE,
|
|
allowNull: false,
|
|
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
|
|
},
|
|
}
|
|
);
|
|
|
|
await queryInterface.addIndex(
|
|
{ schema: 'community', tableName: 'oauth_identity' },
|
|
['provider', 'subject'],
|
|
{ unique: true, name: 'oauth_identity_provider_subject_uniq' }
|
|
);
|
|
|
|
await queryInterface.addIndex(
|
|
{ schema: 'community', tableName: 'oauth_identity' },
|
|
['user_id'],
|
|
{ name: 'oauth_identity_user_idx' }
|
|
);
|
|
},
|
|
|
|
async down(queryInterface) {
|
|
await queryInterface.dropTable({ schema: 'community', tableName: 'oauth_identity' });
|
|
},
|
|
}; |