Refreshable connections, refactoring, access-token endpoint

- Aded /users/@me/connections/:connection_name/:connection_id/access-token
- Replaced `access_token` property on ConnectedAccount with `token_data` object for refreshing tokens
- Made a common interface for connection things like ComonOAuthTokenResponse
- Added `RefreshableConnection` class
- Added token refresh to Spotify connection (disabled)
This commit is contained in:
Puyodead1
2023-03-18 19:27:39 -04:00
parent 50f068400d
commit 0db1fa5f0b
18 changed files with 292 additions and 111 deletions
+4 -3
View File
@@ -17,6 +17,7 @@
*/
import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
import { ConnectedAccountTokenData } from "../interfaces";
import { BaseClass } from "./BaseClass";
import { User } from "./User";
@@ -40,9 +41,6 @@ export class ConnectedAccount extends BaseClass {
})
user: User;
@Column({ select: false, nullable: true })
access_token?: string;
@Column({ select: false })
friend_sync?: boolean = false;
@@ -75,4 +73,7 @@ export class ConnectedAccount extends BaseClass {
@Column()
two_way_link?: boolean = false;
@Column({ select: false, nullable: true, type: "simple-json" })
token_data?: ConnectedAccountTokenData;
}