# Class Auth0Connect

java.lang.Object
com.codename1.social.Login
com.codename1.social.Auth0Connect

public final class Auth0Connect extends Login

Sign-in via an Auth0 tenant. Auth0 is a fully OpenID-Connect compliant provider so this class is a very thin convenience over `OidcClient` -- it just builds the issuer URL from the tenant domain and configures sensible defaults.

    Auth0Connect.getInstance()
        .withDomain("dev-xyz.us.auth0.com")
        .signIn(
            "YOUR_AUTH0_CLIENT_ID",
            "com.example.app:/oauth2redirect",
            "openid", "email", "profile")
        .ready(new SuccessCallback<OidcTokens>() { ... });

To request an Auth0 audience (so the access token can be used against your custom API) pass it via `withAudience(String)` before calling `signIn(String, String, String...)`.

Since:
  8.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getAudience()`
  `String`
  `getDomain()`
  `static Auth0Connect`
  `getInstance()`
  `boolean`
  `isNativeLoginSupported()`
  Returns true if this service supports native login.
  `AsyncResource<OidcTokens>`
  `signIn(String clientId, String redirectUri, String... scopes)`
  `protected boolean`
  `validateToken(String token)`
  Returns true if the previous granted access token is still valid otherwise false.
  `Auth0Connect`
  `withAudience(String audience)`
  Optional `audience` parameter for API authorization.
  `Auth0Connect`
  `withDomain(String domain)`
  Auth0 tenant domain (e.g. `"dev-xyz.us.auth0.com"`).

  ### Methods inherited from class Login

  `addScopes, connect, createOauth2, doLogin, doLogin, doLogout, getAccessToken, isPreferRedirectPrompt, isUserLoggedIn, nativeIsLoggedIn, nativelogin, nativeLogout, setAccessToken, setCallback, setClientId, setClientSecret, setOauth2URL, setPreferRedirectPrompt, setRedirectURI, setScope, validateToken`

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### getInstance

    public static Auth0Connect getInstance()

  - ### withDomain

    public Auth0Connect withDomain(String domain)
    Auth0 tenant domain (e.g. `"dev-xyz.us.auth0.com"`). Do not include the protocol -- it is always `https://`.

  - ### withAudience

    public Auth0Connect withAudience(String audience)
    Optional `audience` parameter for API authorization. When set, the access token issued by Auth0 will be a JWT valid against your API identifier instead of the default opaque token.

  - ### getDomain

    public String getDomain()

  - ### getAudience

    public String getAudience()

  - ### isNativeLoginSupported

    public boolean isNativeLoginSupported()
    Description copied from class: `Login`

    Returns true if this service supports native login. If implementation returns true here, the nativelogin, nativelogout, nativeIsLoggedIn should be implemented

    ###### Returns

    true if the service supports native login

    Specified by:
      `isNativeLoginSupported` in class `Login`

  - ### validateToken

    protected boolean validateToken(String token)
    Description copied from class: `Login`

    Returns true if the previous granted access token is still valid otherwise false.

    ###### Parameters

    - `token`: the access token to check

    ###### Returns

    true of the token is valid

    Specified by:
      `validateToken` in class `Login`

  - ### signIn

    public AsyncResource<OidcTokens> signIn(String clientId, String redirectUri, String... scopes)