UBERF-8251: Fix github re-authenticate (#6704)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2024-09-24 16:20:00 +07:00 committed by GitHub
parent 4ae95a447f
commit 33e132cb00
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -24,10 +24,10 @@ export async function onAuthorize (login?: string): Promise<void> {
)
const client = getClient()
const config = await client.findOne(github.class.GithubAuthentication, {})
if (config !== undefined) {
await client.remove(config)
// Remove old authorizations.
const config = await client.findAll(github.class.GithubAuthentication, {})
for (const c of config) {
await client.remove(c)
}
await client.createDoc<GithubAuthentication>(github.class.GithubAuthentication, core.space.Workspace, {
attachedTo: meId,