@@ -79,19 +79,24 @@ export class ApplePortalSessionService implements IApplePortalSessionService {
7979 return result ;
8080 }
8181
82- public async createWebSession (
83- contentProviderId : number ,
84- dsId : string
85- ) : Promise < string > {
82+ public async createWebSession ( contentProviderId : string ) : Promise < string > {
8683 const webSessionResponse = await this . $httpClient . httpRequest ( {
8784 url :
88- "https://appstoreconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ v1/session/webSession " ,
85+ "https://appstoreconnect.apple.com/olympus/ v1/providerSwitchRequests " ,
8986 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+ } ,
95100 headers : {
96101 Accept : "application/json, text/plain, */*" ,
97102 "Accept-Encoding" : "gzip, deflate, br" ,
@@ -132,7 +137,7 @@ export class ApplePortalSessionService implements IApplePortalSessionService {
132137 try {
133138 await this . loginCore ( credentials ) ;
134139 } catch ( err ) {
135- const statusCode = err && err . response && err . response . statusCode ;
140+ const statusCode = err && err . response && err . response . status ;
136141 result . areCredentialsValid = statusCode !== 401 && statusCode !== 403 ;
137142 result . isTwoFactorAuthenticationEnabled = statusCode === 409 ;
138143
@@ -177,11 +182,11 @@ For more details how to set up your environment, please execute "tns publish ios
177182 "X-Apple-Widget-Key" : loginConfig . authServiceKey ,
178183 Accept : "application/json, text/javascript" ,
179184 } ;
180- const body = JSON . stringify ( {
185+ const body = {
181186 accountName : credentials . username ,
182187 password : credentials . password ,
183188 rememberMe : true ,
184- } ) ;
189+ } ;
185190
186191 const loginResponse = await this . $httpClient . httpRequest ( {
187192 url : loginUrl ,
@@ -244,11 +249,11 @@ For more details how to set up your environment, please execute "tns publish ios
244249 await this . $httpClient . httpRequest ( {
245250 url : `https://idmsa.apple.com/appleauth/auth/verify/trusteddevice/securitycode` ,
246251 method : "POST" ,
247- body : JSON . stringify ( {
252+ body : {
248253 securityCode : {
249254 code : token . toString ( ) ,
250255 } ,
251- } ) ,
256+ } ,
252257 headers : { ...headers , "Content-Type" : "application/json" } ,
253258 } ) ;
254259
0 commit comments