Refresh token is empty. Please check your backend response

I’ve racked my brain on this for 20 hours straight and I can’t figure it out. I’m working on an ember app with a django backend. It uses jwt for authorization, the endpoint to generate the initial tokens is:


and it generates the following (I’ve changed the strings here for security, but I do get back valid web tokens):

"data": {
    "refresh": "dsjgkdsfjgdfslkjgfdjgkldfjglsdfkjgfdlkgjfdlg",
    "access": "dsdgjdsgjdsgjdfsgjdfsklgjdfslgjdfsgjfdsgjdflgjdfk;gjdfsl;gjdfgjfdklgjfdlgI"

When the access token expires I try to send the refresh token to /token/refresh but the response I get back is :

Uncaught (in promise) Error: Refresh token is empty. Please check your backend response

I’m using the ember-simple-auth-token addon

and I believe I’ve set up the config properly in environment.js:

'ember-simple-auth-token': {
  tokenDataPropertyName: 'tokenData', // Key in session to store token data
  refreshAccessTokens: true, // Enables access token refreshing
  tokenExpirationInvalidateSession: true, // Enables session invalidation on token expiration
  serverTokenRefreshEndpoint: 'http://localhost:8000/api/token/refresh/', // Server endpoint to send refresh request
  refreshTokenPropertyName: 'refresh', // Key in server response that contains the refresh token
  tokenExpireName: 'exp', // Field containing token expiration
  refreshLeeway: 290, // Amount of time to send refresh request before token expiration
  serverTokenEndpoint: 'http://localhost:8000/api/token/',
  tokenPropertyName: 'access',

Any help would be greatly appreciated, thank you.

Not familiar with this addon but looking at the source it seems like setting the refreshTokenPropertyName to data.refresh would help. Interesting to know if it’s finding the access token ok?

This is what leads me to believe the token properties should be changed

Example: If refreshTokenPropertyName is “data.user.refreshToken”, makeRefreshData will return {data: {user: {refreshToken: “token goes here”}}}

I think I figured it out, the addon expects a refresh property in the response. Even if it hits the /token/refresh/ endpoint, which were not including.