Trying to figure out clientContext, could use some help

Hey everyone,

I’m working on creating a website for a local newspaper as part of an internship I’m doing for school. I decided to use React, and I found that Netlify suits my needs pretty well.

I managed to add Netlify’s identity widget to my site, which you can check out over at lakesidenews.netlify.app.

Now I need to figure out how to use clientContext to update some information on my site. For example, my first goal here is to have it so that once you have logged in, the text at the top right of the screen will say “Log Out” instead of “Login”… which I just now realized is kind of a typo.

The documentation on Netlify’s site has proven a little bit too technical for me. I found this: Functions and Identity | Netlify Docs
and this: Trigger functions on events | Netlify Docs
and I’m sure my answer lies somewhere in there, but I’m not particularly familiar with JSON, and honestly, like I said, that documentation is just a little too technical for me.

If anyone could help I would greatly appreciate it! Thank you!

This is basically just a bump but I’ll give some more information:
I’ve been working through this tutorial. I think I need to use Lambda functions to access the clientContext, but the tutorial I am using is making an API call to GitHub, which I don’t need to do.

I’m also not sure how to serve lambda functions once my app is deployed - I’m making use of Netlify’s continuous deployment via GitHub, but even though the Netlify documentation says a function named after an identity event will trigger automatically, that doesn’t seem to be working for me.

Also, the UI for adding hyperlinks is super broken.

Hi @DonovanTT, welcome to the community!

If you just need for your site to show that someone is logged in or not, you could just check for the nf_jwt cookie. If it it exists, you can change the text to Logout. This will require some javascript that you would need to write yourself but is still much more simpler than a lambda function.

Hope that helps.