diff --git a/backend/src/services/OAuthService.js b/backend/src/services/OAuthService.js index 1cd2e81..c166036 100644 --- a/backend/src/services/OAuthService.js +++ b/backend/src/services/OAuthService.js @@ -70,6 +70,7 @@ class OAuthService { } authIdentity = await AuthIdentity.create({ + id: await this.getNextAuthIdentityId(AuthIdentity), auth_info_id: authInfo.id, provider, identity: providerId, @@ -127,6 +128,7 @@ class OAuthService { // OAuth-Identity erstellen authIdentity = await AuthIdentity.create({ + id: await this.getNextAuthIdentityId(AuthIdentity), auth_info_id: authInfo.id, provider, identity: providerId, @@ -139,6 +141,11 @@ class OAuthService { return this.createLoginResult(user, authInfo, provider); } + async getNextAuthIdentityId(AuthIdentity) { + const maxId = await AuthIdentity.max('id'); + return Number(maxId || 0) + 1; + } + createPendingToken(profile, provider) { return jwt.sign( { @@ -288,4 +295,3 @@ class OAuthService { } module.exports = new OAuthService(); -