File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -468,6 +468,16 @@ export interface IStoredClientOpts extends IStartClientOpts {
468
468
canResetEntireTimeline : ResetTimelineCallback ;
469
469
}
470
470
471
+ export interface IRefreshTokenOpts {
472
+ /**
473
+ * If true, forces refreshToken to use `/v1` API prefix instead of correct
474
+ * `/v3`. Useful for targeting Synapse before v1.72.
475
+ * https://github.com/matrix-org/synapse/pull/14364
476
+ * @defaultValue false
477
+ */
478
+ forcePrefixV1 ?: boolean ;
479
+ }
480
+
471
481
export enum RoomVersionStability {
472
482
Stable = "stable" ,
473
483
Unstable = "unstable" ,
@@ -7517,14 +7527,14 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
7517
7527
* @returns Promise which resolves to the new token.
7518
7528
* @returns Rejects with an error response.
7519
7529
*/
7520
- public refreshToken ( refreshToken : string ) : Promise < IRefreshTokenResponse > {
7530
+ public refreshToken ( refreshToken : string , options : IRefreshTokenOpts = { } ) : Promise < IRefreshTokenResponse > {
7521
7531
return this . http . authedRequest (
7522
7532
Method . Post ,
7523
7533
"/refresh" ,
7524
7534
undefined ,
7525
7535
{ refresh_token : refreshToken } ,
7526
7536
{
7527
- prefix : ClientPrefix . V3 ,
7537
+ prefix : options . forcePrefixV1 ? ClientPrefix . V1 : ClientPrefix . V3 ,
7528
7538
inhibitLogoutEmit : true , // we don't want to cause logout loops
7529
7539
} ,
7530
7540
) ;
You can’t perform that action at this time.
0 commit comments