Hi, I am trying implement JWT. And I can get successful BearerToken in Swagger-UI but while trying with Ajax query I am not getting them.
Here is my request - response
For Swagger
request
{
"provider": "credentials",
"State": "string",
"oauth_token": "string",
"oauth_verifier": "string",
"UserName": "Kunjan",
"Password": "password",
"RememberMe": false,
"Continue": "string",
"nonce": "string",
"uri": "string",
"response": "string",
"qop": "string",
"nc": "string",
"cnonce": "string",
"UseTokenCookie": true,
"AccessToken": "string",
"AccessTokenSecret": "string",
"Meta": {}
}
and response
{
"UserId": "1",
"SessionId": "uF4RkNMH793wBeMOifdb",
"UserName": "Kunjan",
"DisplayName": "Kunjan",
"ReferrerUrl": "string",
"BearerToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImtpZCI6ImQ2NiJ9.eyJzdWIiOjEsImlhdCI6MTQ5NTUwODkxMywiZXhwIjoxNDk2NzE4NTEzLCJnaXZlbl9uYW1lIjoiS3VuamFuIiwiZmFtaWx5X25hbWUiOiJEYWxhbCIsIm5hbWUiOiJLdW5qYW4iLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJLdW5qYW4iLCJyb2xlcyI6WyJBZG1pbiJdfQ.YniGmrf7F2SYhm0tBZW-4vHzjuem-pk7PKmWC-hLswI",
"RefreshToken": "eyJ0eXAiOiJKV1RSIiwiYWxnIjoiSFMyNTYiLCJraWQiOiJkNjYifQ.eyJzdWIiOjEsImlhdCI6MTQ5NTUwODkxMywiZXhwIjoxNTI3MDQ0OTEzfQ.Sqq9o9oHL4zSycsvCTwVZ4hFubxCUOo3DFSjXM-Ntbg",
"ResponseStatus": {}
}
Now for Ajax
similar request
{
"provider@": "credentials",
"State@": null,
"oauth_token@": null,
"oauth_verifier@": null,
"UserName@": "Kunjan",
"Password@": "password",
"RememberMe@": false,
"Continue@": null,
"nonce@": null,
"uri@": null,
"response@": null,
"qop@": null,
"nc@": null,
"cnonce@": null,
"UseTokenCookie@": true,
"AccessToken@": null,
"AccessTokenSecret@": null,
"Meta@": null
}
I m getting response as below
{
"UserId": "1",
"SessionId": "V8wCKxOooCwLsQ1cn2jp",
"DisplayName": "Kunjan",
"ReferrerUrl": "http://localhost:8080/",
"ResponseStatus": {}
}
So, here are two questions
- As I am getting sessionId in both response does that mean that session is cached on server ?
- While doing Ajax query why I am not getting token as I am getting it while using swagger-ui?
Server and client (webpack-dev) are on different domain. I have allowed CORS for that domain so all other requests (GET, POST, PUT, DELETE) are working with server.