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:

import React from "react"
import { getUser } from "@limio/sdk"
‚Äč
const Navbar = () => {
const user = getUser()
return (
<nav>
<h1>Shop</h1>
<ul>
<li>
<p>Logged in as {user.email}</p>
</li>
<li>
<button>Log Out</button>
</li>
</ul>
</nav>
)
}

Example user:

{
attributes: {
aud: "3kde1g4qurqbdmf7p81n6568m0",
auth_time: 1610643100,
"cognito:username": "dummy_user",
email_verified: true,
event_id: "743826f5-075c-4c36-8bb2-bf343be46f09",
exp: 1611848843,
iat: 1611845243,
iss: "https://cognito-idp.eu-central-1.amazonaws.com/eu-central-1_AVrsbOxSU",
sub: "d183e0ec-8baf-4320-b847-c78fad0b1df8",
token_use: "id"
},
loaded: true,
token:
"eyJraWQiOiJrdHFNMjE0WnlZRlhRVklEMGRCUTJ3Y1NRUThtMytJU1QwUHoyc0YyUGVZPSIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiJkMTgzZTBlYy04YmFmLTQzMjAtYjg0Ny1jNzhmYWQwYjFkZjgiLCJldmVudF9pZCI6Ijc0MzgyNmY1LTA3NWMtNGMzNi04YmIyLWJmMzQzYmU0NmYwOSIsInRva2VuX3VzZSI6ImFjY2VzcyIsInNjb3BlIjoiYXdzLmNvZ25pdG8uc2lnbmluLnVzZXIuYWRtaW4iLCJhdXRoX3RpbWUiOjE2MTA2NDMxMDAsImlzcyI6Imh0dHBzOlwvXC9jb2duaXRvLWlkcC5ldS1jZW50cmFsLTEuYW1hem9uYXdzLmNvbVwvZXUtY2VudHJhbC0xX0FWcnNiT3hTVSIsImV4cCI6MTYxMTg0ODg0MywiaWF0IjoxNjExODQ1MjQzLCJqdGkiOiIxNGZlMmVmMi1lYTM5LTQ3ZjItYmNlYS00YzkwOWJjMGQzNmMiLCJjbGllbnRfaWQiOiIza2RlMWc0cXVycWJkbWY3cDgxbjY1NjhtM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