Working with Auth0 User Profile Information and Metadata in Android Apps
Tags: android, programming, mobile
Published: 2021-12-21 13:06:01

#### Learn about the three kinds of information stored with each Auth0 user account and how to access them in your Android apps.

### <br>

After authenticating your Android app’s users (which you can learn in this tutorial), you’ll probably want to know more about them and even store information about them as well. 

Your app might need to know the email addresses associated with the user’s account or the user’s various names (given name, family name, or perhaps a nickname). You will probably store the settings and preferences that the user provides. You may also want to keep track of values that affect the app’s functionality. In a game, these could be things like the current level or high score; in a productivity app, these might be information such as if the user has performed a specific action or where the user is in a given workflow.

You might not be aware that Auth0’s user accounts store different kinds of information about each user. In this article, you’ll learn about the information in Auth0 user accounts by adding the functionality to access this information to an existing app.

> **Look for the 🛠 emoji if you’d like to skim through the content while focusing on the build and execution steps.**


## What You’ll Build

You’ll start with a pre-built simple, single-screen Android app that will allow the user to log in and log out using Auth0. You’ll write some additional code that will give the app the ability to access these three different kinds of information about the user:

1. Their user profile
2. Their user metadata
3. Their app metadata

I’ll explain what these are as I take you on a tour of the app.

The purpose of this app is to demonstrate how you access the three different kinds of user information stored in each user account. Let’s look at them in detail.


### The user profile

When the user runs the app and logs in successfully, the first set of user information they’ll see is the ***user profile***. It takes up most of the app’s screen, and you’ll need to scroll to see it all. Here’s the first part...

![The top portion of the app’s main screen, featuring the “Log in”/“Log out” buttons and user data](https://images.ctfassets.net/23aumh6u8s0i/tClYf5lRreoksoX2MCYn9/d3b9892bff2bc8b392c83122156b44bc/complete_android_app_-_part_1.png)

...and here’s the rest:

![The bottom portion of the app’s main screen, featuring the user metadata and app metadata](https://images.ctfassets.net/23aumh6u8s0i/7xK6m0AJenuskBLJmvZwlB/2aeba904161494cb4a23133aff9e297b/complete_android_app_-_part_2.png)

The user profile is a small set of essential user data that can be found in most user accounts, regardless of identity provider. The Auth0 Android library provides access to this information as properties of a `UserProfile` object. These properties are:

* **`name`**: The user’s full name, typically their first and last names, as a single string.
* **`givenName`**: The user’s given name, or what we would call the user’s “first name” in the western world.
* **`familyName`**: The user’s family name.
* **`nickname`**: The user’s nickname. This is often the name used to log in.
* **`email`**: The email address associated with this user account.
* **`isEMailVerified`**: A boolean whose value is `true` if the user verified that the value in `email` is their email address.
* **`pictureURL`**: The URL for an image of the user or some representation of the user.
* **`createdAt`**: The date and time when the user account was created.
* **`extraInfo`**: Extra information associated with the user account, stored as a JSON dictionary converted into a `Map<String, Any>` instance. The kind of information stored in this value depends on the identity provider.

### User metadata

You’ll find the ***user metadata*** when you scroll to the bottom of the app’s screen:

![The bottom portion of the app’s main screen, with the user metadata highlighted](https://images.ctfassets.net/23aumh6u8s0i/37PCpShh5k6zBisyuGBSwB/94292112593866a6b16c32915dfacae3/android_app_user_metadata.png)

The user metadata is a set of attributes about the user that *don’t* affect the app’s core functionality. The user should be able to view and modify this information, and as such, it’s typically used to store user preferences and settings.


[Read more...](https://auth0.com/blog/working-auth0-user-profile-information-metadata-android-apps/?utm_source=content_synd&utm_medium=sc&utm_campaign=android)