Hello,
I have implemented Auth0 with the React app. I also check session from the Auth0 JS library to keep connection alive. But the weird thing happens, when I send request to custom API the session seems to be deleted or something.
Here is the excerpt of the request:
// saga.js
function * updateUser ({ payload }) {
try {
...
yield put(updateUserRoutine.request())
const data = yield authenticatedRequest('patch', '/me', data)
auth0Client.silentAuth() // this is only for debug purpose - resolves in error. If request line above is commented out resolves in new access token
yield put(updateUserRoutine.success())
...
}
...
}
// Auth.js
silentAuth = () => {
this.auth0.checkSession({ scope: this.getScope() || 'openid profile email' }, (err, authResult) => {
if (err) {
console.log(err)
return
}
this.setSession(authResult)
})
}
So after request is sent checkSession
(auth0Client.silentAuth()) resolves in error {error: "login_required", error_description: "Login required"}
. When I remove API request everything works fine.
Also I should probably mention that API is on different domain than the React app. Any help or guidance is much appreciated