Created
January 28, 2020 18:51
-
-
Save timmyc/ba87390aba75b89181193bc55ed0ef9d to your computer and use it in GitHub Desktop.
tweaks to induce the retryAuth code path
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/client/jetpack-connect/authorize.js b/client/jetpack-connect/authorize.js | |
index 0cbcb1bf79..ec193679bc 100644 | |
--- a/client/jetpack-connect/authorize.js | |
+++ b/client/jetpack-connect/authorize.js | |
@@ -726,7 +726,7 @@ const connectComponent = connect( | |
const isMobileAppFlow = !! mobileAppRedirect; | |
return { | |
- authAttempts: getAuthAttempts( state, urlToSlug( authQuery.site ) ), | |
+ authAttempts: 1, | |
authorizationData: getAuthorizationData( state ), | |
calypsoStartedConnection: isCalypsoStartedConnection( authQuery.site ), | |
canManageOptions: canCurrentUser( state, authQuery.clientId, 'manage_options' ), | |
diff --git a/client/state/jetpack-connect/actions.js b/client/state/jetpack-connect/actions.js | |
index c860e284b8..8038b8cb29 100644 | |
--- a/client/state/jetpack-connect/actions.js | |
+++ b/client/state/jetpack-connect/actions.js | |
@@ -342,101 +342,12 @@ export function authorize( queryObject ) { | |
secret, | |
state, | |
} = queryObject; | |
- debug( 'Trying Jetpack login.', _wp_nonce, redirect_uri, scope, state ); | |
- dispatch( recordTracksEvent( 'calypso_jpc_authorize', { from, site: client_id } ) ); | |
dispatch( { | |
- type: JETPACK_CONNECT_AUTHORIZE, | |
- queryObject: queryObject, | |
+ type: JETPACK_CONNECT_AUTHORIZE_RECEIVE, | |
+ siteId: client_id, | |
+ data: null, | |
+ error: 'error', | |
} ); | |
- return wpcom | |
- .undocumented() | |
- .jetpackLogin( client_id, _wp_nonce, redirect_uri, scope, state ) | |
- .then( data => { | |
- debug( 'Jetpack login complete. Trying Jetpack authorize.', data ); | |
- dispatch( { | |
- type: JETPACK_CONNECT_AUTHORIZE_LOGIN_COMPLETE, | |
- data, | |
- } ); | |
- return wpcom | |
- .undocumented() | |
- .jetpackAuthorize( client_id, data.code, state, redirect_uri, secret, jp_version, from ); | |
- } ) | |
- .then( data => { | |
- debug( 'Jetpack authorize complete. Updating sites list.', data ); | |
- dispatch( { | |
- type: JETPACK_CONNECT_AUTHORIZE_RECEIVE, | |
- siteId: client_id, | |
- data: data, | |
- error: null, | |
- } ); | |
- | |
- // Update the user now that we are fully connected. | |
- const user = userFactory(); | |
- user.fetching = false; | |
- user.fetch(); | |
- | |
- // @TODO: When user fetching is reduxified, let's get rid of this hack. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment