Skip to content

Commit

Permalink
jwt support
Browse files Browse the repository at this point in the history
  • Loading branch information
jm1021 committed Dec 7, 2023
1 parent 7a2c35e commit 89063e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion _posts/2023-12-15-python-jwt-database.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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',
},
};
Expand Down
8 changes: 6 additions & 2 deletions _posts/2023-12-15-python-jwt-login.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand Down Expand Up @@ -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);
});
}


Expand Down

0 comments on commit 89063e5

Please sign in to comment.