Reputation: 1731
I have implemented an Authentication on my WebApi from the following guidance: C-SharpCorner
Anyway, after implementating it is working fine. However when i am calling the token from Postman, token returns me the following Object:
{
"access_token": "oBXQaEgd6LkahHQhvOGak-HpsZTSSYlR8h7Rcz6q4twD4d0El6xq62j8OTWiW-Hhtn5y9y-Npw0byNlS1sG6l0UoKYrkBifpEYm9eXrx6CzcTPsOLMVkqcrrnYxxjJ6xZznM3SHMc8UVUV35PO7C9MOgQN-DaPf_YJVkEmdqotkrnGQavT40rmlGMb-NbzRKDPYCJ_xPXvgaX3JPX6kZNf7ObsOJS9fiexUc0rPA7vk",
"token_type": "bearer",
"expires_in": 14399,
"userName": "TestUser",
".issued": "Tue, 21 May 2019 07:32:58 GMT",
".expires": "Tue, 21 May 2019 11:32:58 GMT"
}
This object has last two variables that starts with Period
, .issued
and .expires
. I never came across this, i researched and couldn't find what these dots are for and also copied pasted/assigned this return obj on browser control where when i try to access them from the object such as obj = {".issued": "Tue, 21 May 2019 07:32:58 GMT"}
I am unable to see it. I presume this must be for privatization/encapsulation but still what if i'm wrong?..
so my question is what is the purpose of the period
as prefix on the last two variables and how they work. Thank you.
Upvotes: 1
Views: 75
Reputation: 494
The period has no particular meaning, some people put it to make it visually easier to recognize that it's a property.
You may access these properties using their name like this: token[".expires"]
which will return "Tue, 21 May 2019 11:32:58 GMT"
for the example you've provided.
Upvotes: 1
Reputation: 558
.issued
is nothing but time stamp when that token is created, similarly .expires
is the timestamp when this token will expire and you will require to either renew same or request new on to be authentic to server.
period is suffix matters less as these are just keys which could have any name.
Upvotes: 1