User
This page describes all of the page/campaign methods available within the Limio SDK.

getUser - Retrieving details of the current user

If you need to find out if a user is validated and get some details about that user, you can use the getUser method.
Example to display authenticated user's email in a navigation bar:
1
import React from "react"
2
import { getUser } from "@limio/sdk"
3
4
const Navbar = () => {
5
const user = getUser()
6
7
return (
8
<nav>
9
<h1>Shop</h1>
10
<ul>
11
<li>
12
<p>Logged in as {user.email}</p>
13
</li>
14
<li>
15
<button>Log Out</button>
16
</li>
17
</ul>
18
</nav>
19
)
20
}
Copied!
Example user:
1
{
2
attributes: {
3
aud: "3kde1g4qurqbdmf7p81n6568m0",
4
auth_time: 1610643100,
5
"cognito:username": "dummy_user",
6
7
email_verified: true,
8
event_id: "743826f5-075c-4c36-8bb2-bf343be46f09",
9
exp: 1611848843,
10
iat: 1611845243,
11
iss: "https://cognito-idp.eu-central-1.amazonaws.com/eu-central-1_AVrsbOxSU",
12
sub: "d183e0ec-8baf-4320-b847-c78fad0b1df8",
13
token_use: "id"
14
},
15
loaded: true,
16
token:
17
"eyJraWQiOiJrdHFNMjE0WnlZRlhRVklEMGRCUTJ3Y1NRUThtMytJU1QwUHoyc0YyUGVZPSIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiJkMTgzZTBlYy04YmFmLTQzMjAtYjg0Ny1jNzhmYWQwYjFkZjgiLCJldmVudF9pZCI6Ijc0MzgyNmY1LTA3NWMtNGMzNi04YmIyLWJmMzQzYmU0NmYwOSIsInRva2VuX3VzZSI6ImFjY2VzcyIsInNjb3BlIjoiYXdzLmNvZ25pdG8uc2lnbmluLnVzZXIuYWRtaW4iLCJhdXRoX3RpbWUiOjE2MTA2NDMxMDAsImlzcyI6Imh0dHBzOlwvXC9jb2duaXRvLWlkcC5ldS1jZW50cmFsLTEuYW1hem9uYXdzLmNvbVwvZXUtY2VudHJhbC0xX0FWcnNiT3hTVSIsImV4cCI6MTYxMTg0ODg0MywiaWF0IjoxNjExODQ1MjQzLCJqdGkiOiIxNGZlMmVmMi1lYTM5LTQ3ZjIt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