0
votes

I'm trying to use Auth0 for my mobile application (Xamarin) and I've been following the quickstart guide provided by Auth0.

I've installed the component via Xamarin market (Visual Studio) and to do the integration, I've created a class file dedicated to Auth0 related operations. I copied and pasted the provided code from the quick start guide but visual studio returns this error:

The contextual keyword 'var' may only appear within a local variable declaration or in script code

The code provided used var instead of a normal variable so I'm not sure what I can substitute with it:

using Auth0.SDK;

namespace Application
{
    class LoginHandler
    {
        var auth0 = new Auth0Client(
        "*************",
        "************************");
    }
}

I'm not sure what I'm doing wrong, I'd also like some help implementing the Login UI as the Xamarin guides are deathly outdated.

1
poke poke poke poke - M.Tajima

1 Answers

1
votes

Short answer: You can use Auth0Client instead of var.

internal class LoginHandler
{
    private Auth0Client auth0 = new Auth0Client("***", "*****");
}

Long answer:

The snippet is assuming you would use the Auth0 client instance in a context where it would be considered a local variable and as such it would be valid code. For example:

internal class LoginHandler
{
    public void HandleLogin()
    {
        var auth0 = new Auth0Client("***", "*****");
        // ...
    }
}

If you require assistance in solving other specific issues then you should post specific questions that clearly illustrate the problem you're having.