When called oauth.getAuthCredentials() the IOS app Will Logout.
Closed this issue · 3 comments
logged into the app using a username and password and allowed the permission, then the app synced and came to the home page after the sync was complete. when the user loses the app and reopens it the app will logout and redirect to the logging page with this error message
"LOG SFOauthReactBridge.getAuthCredentials failed: {"message":"Not authenticated"}".
this is my get profile method it will call when the app is loading
const getProfile = () => async dispatch => {
/**
* This function get profile from salesforce
*/
try {
dispatch({ type: START_LOADING_PROFILE });
try {
const auth = oauth.getAuthCredentials();
if (config.debug) console.log('auth profile', auth);
/**Wait until user Data Dispatch to redux Store */
await dispatch({ type: FINISH_LOADING_PROFILE, payload: auth });
} catch (err) {
dispatch({ type: ERROR_LOADING_PROFILE, payload: err });
}
} catch (e) {
if (config.debug) console.log('catch profile Error', e);
dispatch({ type: ERROR_LOADING_PROFILE, payload: e });
}
};
Could you check your connected app refresh token policy and make sure that it is not set to expire immediately?
Furthermore, could you try with the latest version of Mobile SDK (we just released 12.0 yesterday).
Updating from SDK 10.2.0 to SDK 12.0.0 resolved the issue where users would be logged out after logging in and then closing the app. Now, closing the app no longer forces users to re-authenticate upon reopening.
Good to hear @NewTech2000