React-native-auth0: No refresh_token when using offline_access and no way to add device as a field

Created on 13 Feb 2020  路  3Comments  路  Source: auth0/react-native-auth0

Description

I am trying to make sure that when I use webAuth to return an access token, I also get a refresh token so I can silently refresh the token without having to log out the user.

However, when using webAuth like so:

const response = await auth0.webAuth.authorize({
  connection: 'facebook',
  scope: 'offline_access openid profile email',
   audience: 'myaudience',
});

I don't get back any refresh token.

I tried googling the problem but nothing came up. There is one tutorial by Pusher (https://pusher.com/tutorials/auth0-react-native-chat) that suggests you have to add a device field to the request like so:

const response = await auth0.webAuth.authorize({
  connection: 'facebook',
  scope: 'offline_access openid profile email',
  audience: 'myaudience',
  device: DeviceInfo.getUniqueId(),
});

But this also does not seem to work since no refresh token is returned.

Can anyone please tell me how I can get a refresh token? Or make sure I can refresh my token in a different way?

waiting for customer

Most helpful comment

Hi @reinvanimschoot, is your audience an API? If so, make sure you're enabling offline access in the API settings.
Screen Shot 2020-02-14 at 19 37 28

All 3 comments

@lbalmaceda please evaluate

Hi @reinvanimschoot, is your audience an API? If so, make sure you're enabling offline access in the API settings.
Screen Shot 2020-02-14 at 19 37 28

Closing due to inactivity.

Was this page helpful?
0 / 5 - 0 ratings