Skip to content

Commit ba3440a

Browse files
committed
feat: deprecate DeviceOauthService and types
1 parent 2357f89 commit ba3440a

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

src/deviceOauthService.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,24 @@ import { AuthInfo, DEFAULT_CONNECTED_APP_INFO } from './org/authInfo';
1717
import { SFDX_HTTP_HEADERS } from './org/connection';
1818
import { SfError } from './sfError';
1919
import { Messages } from './messages';
20+
import { Lifecycle } from './lifecycleEvents';
2021

2122
Messages.importMessagesDirectory(__dirname);
2223
const messages = Messages.loadMessages('@salesforce/core', 'auth');
2324

25+
/**
26+
* @deprecated Will be removed mid January 2026
27+
*/
2428
export type DeviceCodeResponse = {
2529
device_code: string;
2630
interval: number;
2731
user_code: string;
2832
verification_uri: string;
2933
} & JsonMap;
3034

35+
/**
36+
* @deprecated Will be removed mid January 2026
37+
*/
3138
export type DeviceCodePollingResponse = {
3239
access_token: string;
3340
refresh_token: string;
@@ -68,20 +75,9 @@ async function makeRequest<T extends JsonMap>(options: HttpRequest): Promise<T>
6875
}
6976

7077
/**
71-
* Handles device based login flows
78+
* THIS CLASS IS DEPRECATED AND WILL BE REMOVED MID JANUARY 2026.
7279
*
73-
* Usage:
74-
* ```
75-
* const oauthConfig = {
76-
* loginUrl: this.flags.instanceurl,
77-
* clientId: this.flags.clientid,
78-
* };
79-
* const deviceOauthService = await DeviceOauthService.create(oauthConfig);
80-
* const loginData = await deviceOauthService.requestDeviceLogin();
81-
* console.log(loginData);
82-
* const approval = await deviceOauthService.awaitDeviceApproval(loginData);
83-
* const authInfo = await deviceOauthService.authorizeAndSave(approval);
84-
* ```
80+
* @deprecated Use WebOAuthServer instead
8581
*/
8682
export class DeviceOauthService extends AsyncCreatable<OAuth2Config> {
8783
public static RESPONSE_TYPE = 'device_code';
@@ -95,6 +91,7 @@ export class DeviceOauthService extends AsyncCreatable<OAuth2Config> {
9591

9692
public constructor(options: OAuth2Config) {
9793
super(options);
94+
void Lifecycle.getInstance().emitWarning('Device Oauth flow is deprecated and will be removed mid January 2026');
9895
this.options = options;
9996
if (!this.options.clientId) this.options.clientId = DEFAULT_CONNECTED_APP_INFO.clientId;
10097
if (!this.options.loginUrl) this.options.loginUrl = AuthInfo.getDefaultInstanceUrl();

0 commit comments

Comments
 (0)