diff --git a/_posts/2023-12-15-python-jwt-database.md b/_posts/2023-12-15-python-jwt-database.md index 7c54896c..fa8f613d 100644 --- a/_posts/2023-12-15-python-jwt-database.md +++ b/_posts/2023-12-15-python-jwt-database.md @@ -30,7 +30,7 @@ courses: { csp: {week: 17 }} // prepare URL var url = "https://flask2.nighthawkcodingsociety.com/api/users/"; // Uncomment next line for localhost testing - //url = "http://localhost:8086/api/users/"; + // url = "http://localhost:8086/api/users/"; // set options for cross origin header request const options = { @@ -39,6 +39,7 @@ courses: { csp: {week: 17 }} cache: 'default', // *default, no-cache, reload, force-cache, only-if-cached credentials: 'include', // include, same-origin, omit headers: { + 'Authorization': `Bearer ${jwt}`, 'Content-Type': 'application/json', }, }; diff --git a/_posts/2023-12-15-python-jwt-login.md b/_posts/2023-12-15-python-jwt-login.md index d6946658..3b5ec0a8 100644 --- a/_posts/2023-12-15-python-jwt-login.md +++ b/_posts/2023-12-15-python-jwt-login.md @@ -24,9 +24,9 @@ courses: { csp: {week: 17 }} // URL for deployment var url = "https://flask2.nighthawkcodingsociety.com" // Comment out next line for local testing - //url = "http://localhost:8086" + url = "http://localhost:8086" // Authenticate endpoint - const login_url = url + '/api/users/authenticate'; + // const login_url = url + '/api/users/authenticate'; function login_user(){ @@ -61,6 +61,10 @@ courses: { csp: {week: 17 }} // Redirect to Database location window.location.href = "{{site.baseurl}}/data/database"; }) + // catch fetch errors (ie ACCESS to server blocked) + .catch(err => { + console.error(err); + }); }