# Security button

**URL:** <https://forum.inductiveautomation.com/t/security-button/28239>\
**Category:** General Discussion\
**Created:** [September 13, 2019, 11:39am UTC](https://forum.inductiveautomation.com/t/security-button/28239 "2019-09-13T11:39:52Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexm](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@alexm](https://forum.inductiveautomation.com/u/alexm)\
**Post date:** [September 13, 2019, 11:39am UTC](https://forum.inductiveautomation.com/t/security-button/28239/1 "2019-09-13T11:39:52Z")

</div>

The idea for this post is to implement a button that will request a pop up login for authorisation. For instance, say there is a Fault Reset Button that will reset any error on a system. The idea is to request a login password that only an authorised/competent person will only be allowed to press it after the error investigation has been completed. Any ideas? Thank you in advance.

P.S Does this require scripting? Is it possible to implement this in Perspective?

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [September 13, 2019, 12:11pm UTC](https://forum.inductiveautomation.com/t/security-button/28239/2 "2019-09-13T12:11:51Z")

</div>

Yes you can do this in perspective, yes it will need scripting. Here is a link to [Ignition 8 scripting functions](https://docs.inductiveautomation.com/display/DOC80/Scripting+Functions)  
and here is a link to [system.perspective.isAuthorized](https://docs.inductiveautomation.com/display/DOC80/system.perspective.isAuthorized).  
a generic example would be like so

```auto
path1 = "Authenticated/Roles/Administrator"
isAuthorized = system.perspective.isAuthorized(False, path1)
if isAuthorized:
     run your script

```

---

<div class="post-metadata">

**Author:** ![alexm](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@alexm](https://forum.inductiveautomation.com/u/alexm)\
**Post date:** [September 19, 2019, 6:44pm UTC](https://forum.inductiveautomation.com/t/security-button/28239/3 "2019-09-19T18:44:20Z")

</div>

> [@dkhayes117](#):
>
> path1 = "Authenticated/Roles/Administrator" isAuthorized = system.perspective.isAuthorized(False, path1) if isAuthorized:

Thanks for the help. Do I right click on my button and paste this on "Add HAndler" on configure script?

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [September 19, 2019, 7:10pm UTC](https://forum.inductiveautomation.com/t/security-button/28239/4 "2019-09-19T19:10:22Z")

</div>

right click on button → configure events → onActionPerformed → click plus button → script → write script

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/b/b617ed3839607cd1caeac257828baa3ee233e615.png)

---

<div class="post-metadata">

**Author:** ![alexm](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@alexm](https://forum.inductiveautomation.com/u/alexm)\
**Post date:** [September 19, 2019, 7:15pm UTC](https://forum.inductiveautomation.com/t/security-button/28239/5 "2019-09-19T19:15:24Z")

</div>

> [@dkhayes117](#):
>
> right click on button -\> configure events -\> onActionPerformed -\> click plus button -\> script -\> write script

I do not have the Component Events Options. Any ideas?

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [September 19, 2019, 7:21pm UTC](https://forum.inductiveautomation.com/t/security-button/28239/6 "2019-09-19T19:21:15Z")

</div>

try selecting the component and using ctrl+j

---

<div class="post-metadata">

**Author:** ![alexm](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@alexm](https://forum.inductiveautomation.com/u/alexm)\
**Post date:** [September 19, 2019, 7:25pm UTC](https://forum.inductiveautomation.com/t/security-button/28239/7 "2019-09-19T19:25:45Z")

</div>

Doesn’t seem to be doing anything. I appreciate your help though.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [September 19, 2019, 7:35pm UTC](https://forum.inductiveautomation.com/t/security-button/28239/8 "2019-09-19T19:35:44Z")

</div>

if haven’t already, check out [www.inductiveuniversity.com](http://www.inductiveuniversity.com) It has lots of free videos that will help you learn fast.

---

<div class="post-metadata">

**Author:** ![Paul.Scott](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul.scott/32/4578_2.png) [@Paul.Scott](https://forum.inductiveautomation.com/u/Paul.Scott)\
**Post date:** [September 19, 2019, 8:25pm UTC](https://forum.inductiveautomation.com/t/security-button/28239/9 "2019-09-19T20:25:58Z")

</div>

What version of Ignition are you using? The onActionPerformed Component Event was introduced in Ignition 8.0.2. If you’re not seeing it, then it’s probably because you’re on an older version.

If you don’t want to upgrade, you could instead use the onClick event instead. Really, you just need an event that reliably triggers when the user taps/presses the button.

Also, if you’re having your users actually login, you could use the login Action instead of writing a script.

---

<div class="post-metadata">

**Author:** ![alexm](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@alexm](https://forum.inductiveautomation.com/u/alexm)\
**Post date:** [September 19, 2019, 8:29pm UTC](https://forum.inductiveautomation.com/t/security-button/28239/10 "2019-09-19T20:29:42Z")

</div>

I did try that but it just gave me an error that doesnt explain much.

---

<div class="post-metadata">

**Author:** ![Paul.Scott](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul.scott/32/4578_2.png) [@Paul.Scott](https://forum.inductiveautomation.com/u/Paul.Scott)\
**Post date:** [September 19, 2019, 8:30pm UTC](https://forum.inductiveautomation.com/t/security-button/28239/11 "2019-09-19T20:30:42Z")

</div>

That’s unfortunate. If you post the error here we could offer some better advice.

---

<div class="post-metadata">

**Author:** ![alexm](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@alexm](https://forum.inductiveautomation.com/u/alexm)\
**Post date:** [September 19, 2019, 8:32pm UTC](https://forum.inductiveautomation.com/t/security-button/28239/12 "2019-09-19T20:32:09Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/6/6ed8d6c1648380d30b31417a7227a7eee3080cb8.png)

---

<div class="post-metadata">

**Author:** ![alexm](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@alexm](https://forum.inductiveautomation.com/u/alexm)\
**Post date:** [September 19, 2019, 8:33pm UTC](https://forum.inductiveautomation.com/t/security-button/28239/13 "2019-09-19T20:33:10Z")

</div>

Thanks for that I am on V8.0.0 currently indeed.

---

<div class="post-metadata">

**Author:** ![Paul.Scott](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul.scott/32/4578_2.png) [@Paul.Scott](https://forum.inductiveautomation.com/u/Paul.Scott)\
**Post date:** [September 19, 2019, 8:45pm UTC](https://forum.inductiveautomation.com/t/security-button/28239/14 "2019-09-19T20:45:47Z")

</div>

The login action is trying to redirect the user to your Identity Provider’s login, and failing to do so because your project isn’t configured to use an Identity Provider.  
As represented at the 00:50 mark here: [https://www.inductiveuniversity.com/videos/requiring-authentication/8.0](https://www.inductiveuniversity.com/videos/requiring-authentication/8.0)

You need to set an Identity Provider for the login action to work. However, after rereading the thread, I’m uncertain what exactly you are trying to do.

Which of the following are you trying to do

1. Apply actual authentication, as in have the user log in as an authorized account

…or…

1. Call a popup that lets users type in some password/secret string, and then validate what was typed, all without changing the authenticated user.

Of the above two options, 1 is a bit simpler, but does require you to create and manage your users in an Identity Provider (which could simply be Ignition’s Identity Provider). Option 2 requires a bit of extra work and scripting, but is very possible. Personally, I’d suggest option 1.

---

<div class="post-metadata">

**Author:** ![alexm](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@alexm](https://forum.inductiveautomation.com/u/alexm)\
**Post date:** [September 19, 2019, 9:00pm UTC](https://forum.inductiveautomation.com/t/security-button/28239/15 "2019-09-19T21:00:35Z")

</div>

Very helpful indeed. The aim is to follow No2 if I’m honest but I am not familiar with scripting at all.Ill update to version 8.0.4 and see how that goes. Cheers
