@@ -79,19 +79,24 @@ export class ApplePortalSessionService implements IApplePortalSessionService {
79
79
return result ;
80
80
}
81
81
82
- public async createWebSession (
83
- contentProviderId : number ,
84
- dsId : string
85
- ) : Promise < string > {
82
+ public async createWebSession ( contentProviderId : string ) : Promise < string > {
86
83
const webSessionResponse = await this . $httpClient . httpRequest ( {
87
84
url :
88
- "https://appstoreconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ v1/session/webSession " ,
85
+ "https://appstoreconnect.apple.com/olympus/ v1/providerSwitchRequests " ,
89
86
method : "POST" ,
90
- body : JSON . stringify ( {
91
- contentProviderId,
92
- dsId,
93
- ipAddress : null ,
94
- } ) ,
87
+ body : {
88
+ data : {
89
+ type : "providerSwitchRequests" ,
90
+ relationships : {
91
+ provider : {
92
+ data : {
93
+ type : "providers" ,
94
+ id : contentProviderId ,
95
+ } ,
96
+ } ,
97
+ } ,
98
+ } ,
99
+ } ,
95
100
headers : {
96
101
Accept : "application/json, text/plain, */*" ,
97
102
"Accept-Encoding" : "gzip, deflate, br" ,
@@ -132,7 +137,7 @@ export class ApplePortalSessionService implements IApplePortalSessionService {
132
137
try {
133
138
await this . loginCore ( credentials ) ;
134
139
} catch ( err ) {
135
- const statusCode = err && err . response && err . response . statusCode ;
140
+ const statusCode = err && err . response && err . response . status ;
136
141
result . areCredentialsValid = statusCode !== 401 && statusCode !== 403 ;
137
142
result . isTwoFactorAuthenticationEnabled = statusCode === 409 ;
138
143
@@ -177,11 +182,11 @@ For more details how to set up your environment, please execute "tns publish ios
177
182
"X-Apple-Widget-Key" : loginConfig . authServiceKey ,
178
183
Accept : "application/json, text/javascript" ,
179
184
} ;
180
- const body = JSON . stringify ( {
185
+ const body = {
181
186
accountName : credentials . username ,
182
187
password : credentials . password ,
183
188
rememberMe : true ,
184
- } ) ;
189
+ } ;
185
190
186
191
const loginResponse = await this . $httpClient . httpRequest ( {
187
192
url : loginUrl ,
@@ -244,11 +249,11 @@ For more details how to set up your environment, please execute "tns publish ios
244
249
await this . $httpClient . httpRequest ( {
245
250
url : `https://idmsa.apple.com/appleauth/auth/verify/trusteddevice/securitycode` ,
246
251
method : "POST" ,
247
- body : JSON . stringify ( {
252
+ body : {
248
253
securityCode : {
249
254
code : token . toString ( ) ,
250
255
} ,
251
- } ) ,
256
+ } ,
252
257
headers : { ...headers , "Content-Type" : "application/json" } ,
253
258
} ) ;
254
259
0 commit comments