Auth0 Home Blog Docs

RefreshToken is NULL when passing Audience as an Extra Parameter

Hello,

Looking for help on how to get a RefreshToken when specifying an Audience for my API call.

This is how I setup my Auth0Client in a Xamarin.DROID Project:

IAuth0Client Client { get; set; }
string Audience { get; set; }

var options = new Auth0ClientOptions
{
Domain = “me.auth0.com”,
ClientId = “**********************************”,
Scope = “openid offline_access profile email”
};

Client = new Auth0Client(options);

This is how I specify extra parameters for the LoginAsync() call:

Audience = “https://api.<>.com/the-app”; or similar
LoginResult loginResult = await Client.LoginAsync(new { audience = Audience });

var loginResult = await Client.LoginAsync(options);

Unfortunately, the LoginResult’s RefreshToken is NULL. Is there any way to receive a RefreshToken in the LoginResult?

loginResult.RefreshToken,

I appreciate any help.

Thanks.

From your description it seems that refresh token is only not returned when adding an audience so although you may have done this already, it would be important to check that the API associated with the given audience has the toggle Allow Offline Access enabled as otherwise refresh tokens won’t be issued. You can check this in the API settings page.

1 Like