Is it possible for me to create an authenticated application on Appsmith?

I’d like to authenticate users on my application before they can access the pages for the application I built on Appsmith.

How do I do that?

Answers from @Nikhil

There are 2 to do this depending on whether

  • You would like to use Appsmith’s authentication
  • You have your own authentication

If you are using Appsmith’s authentication, you can invite a user using the share button inside the application and they will receive an email inviting them to use the app with the role you specified.

If you have your own authentication, you can create a login page with a button that hits your authentication API and stores the access token onSuccess using the storeValue function.

This access token can now be sent to subsequent API calls by referencing it in the headers as
{{ appsmith.store.accessToken }}

1 Like

Hello @vihar could you explain better this second process? Do you have any documentation about that? Appsmith has any option to create users by api regardless by UI? Thanks for now.

Hey @rodrigoscdc, you can set up custom authentication on Appsmith using your own APIs. Here’s a detailed guide.

@vihar How do you check on every request the JWT token is valid and if expired how to trigger the page to redirect to the login page?

@irwanazam if the request fails, you can handle it in the onError callback

Any way to check on page load?

1 Like

Hi, did you manage to figure this out?
I want to run a query on page load but also handle the success and error scenarios to redirect the user to a dedicated page.

Hey, you can use navigateTo() inside the onSuccess/OnError functions within run()

Hi @dancia thanks for your reply.
The thing is, I have an API query that will return http 200 if the user is authenticated or 403 if the user is not (based on a token found in querystring).
My dilema is:

  • If i place the code under onclick event of a button everything works fine but the user has to click the button; I want it to happen when the page loads.
  • If I place the code under container.visible property then Query1.run() is not recognized as a function
  • If I set the query to run on page load, in the query settings, then there is no way to control the onsuccess/onError events.

Hi @lucianb based on your scenario this would have been possible by using JSObjects. But, unfortunately, today, functions defined in JSObject cannot be called on page load. This is something we are working on. You can track the issue here - feat: Settings js editor by ApekshaBhosale · Pull Request #9984 · appsmithorg/appsmith · GitHub

Hi there,
trying to do the “How to implement custom authentication on Appsmith” guide,
but the explanation on how to get the URL is a bit vague, could someone assist please?

@armant I see you have started an individual thread for this, so replying to you there.