Is this the correct way to use AWS Cognito?

I am doing the following in my React/Node App:

  1. Using the User Pools for a Cognito App that I have created
  2. Calling the /login endpoint with response_type=token in my React App
  3. Once I receive the JWT token, I pass it to my node/express server in a header (my server is using ssl)
  4. On the Node server, using cognito-express package to call cognitoExpress.validate(accessTokenFromClient, callback) to validate the token
  5. If the call is successful, saving the user details (email etc) and the jwt in localStorage in the React App

And then, for every call to my server, I am repeating steps 3 and 4 above (validating jwt) to ensure that the user is Authenticated.

My concerns with the above approach is:

  1. I am unsure if the cognito-express is actually calling Cognito, or is it just decoding the jwt and making a decision on its validity locally

  2. I tried leaving the session open overnight, and I expected that the call to cognitoExpress.validate(accessTokenFromClient, callback) would fail (because the jwt expires in a hour), but it didnt. Does this mean that an expired jwt token is considered as a valid claim

  3. If the user was Authenticated and his JWT has expired, how do I refresh the JWT without asking him to login again?

Knockout.js What is the correct way to reference $parent on js file?

I am new on Knockout.js, especially on how to use it in the Magento way.

I create a custom ViewModel with a js file called storepickup-select.js and an HTML template called storepickup-select.html.

I override Magento_Checkout/js/view/shipping on a custom shipping.js file on my custom module. In this file, I added two functions: selectedCarrierCode and saveStoreAddress.

When I call selectedCarrierCode on storepickup-select.html using the $ parent variable, it works fine and without any problem:

<form class="form form-shipping-storepickup" id="co-storepickup-form" data-bind="visible: $  parent.selectedCarrierCode()"> ... </form> 

But when I tried to call saveStoreAddress from storepickup-select.js, it throws me an error:

selectStore: function(){     ...                                 $  parent.saveStoreAddress(addresData);     ... } 

ReferenceError: $ parent is not defined

I tried some other options:

parent  this.parent this.$  parent 

But it doesn´t work. Why I can use $ parent on HTML file but I can´t use it on js file? And, what is the better way to call saveStoreAddress from js file?

Thanks.

Firebase – onAuthStateChanged does not return correct formatted object

My app is working correctly until a few minutes ago.

According to documentation, the user object returned will have following properties:

firebase.auth().onAuthStateChanged(function(user) {   if (user) {     var displayName = user.displayName;     var email = user.email;     var emailVerified = user.emailVerified;     var photoURL = user.photoURL;     var isAnonymous = user.isAnonymous;     var uid = user.uid;     var providerData = user.providerData;   } else {     // User is signed out.   } }); 

If I want to access uid, I can just call user.uid.

But the problem is I discovered this behavior is broken while I was developing new features a few minutes ago.

If I want to access properties like uid or email, now I need to access it like this:

user._user.uid or user._user.email

Why does this happened?

Is Firebase doing any update?