Empty token response error
oblakeerickson opened this issue · 1 comments
oblakeerickson commented
Even with tokenPropertyName
set I'm getting an error that it can't find the token from the server response.
Error: "Refresh token is empty. Please check your backend response."
Here is my setup:
//config/environment.js
ENV['ember-simple-auth-token'] = {
serverTokenEndpoint: '/session/',
tokenPropertyName: "session.jwt",
};
//app/controllers/login.js
actions: {
authenticate: function() {
const credentials = {};
credentials.session = this.getProperties('email', 'password');
const authenticator = 'authenticator:jwt'; // or 'authenticator:jwt'
this.session.authenticate(authenticator, credentials)
.catch((error) => {
console.log(error);
})
}
And this is the response from my server that contains the jwt:
Looks like it is hitting this line
const token = get(response, this.tokenPropertyName);
but it is unclear why not not able to find the token from the response. Any thoughts?
oblakeerickson commented
Ohh I think setting tokenPropertyName
to "session.jwt" fixed the first error, and now I'm getting the same error for the refresh token. Let me update refreshTokenPropertyName
as well and configure my server to return that value.