# Navigate to new view from onAuthChallengeCompleted event script

**URL:** <https://forum.inductiveautomation.com/t/navigate-to-new-view-from-onauthchallengecompleted-event-script/101487>\
**Category:** Ignition\
**Created:** [January 28, 2025, 12:39pm UTC](https://forum.inductiveautomation.com/t/navigate-to-new-view-from-onauthchallengecompleted-event-script/101487 "2025-01-28T12:39:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dhiraj.pawar](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@dhiraj.pawar](https://forum.inductiveautomation.com/u/dhiraj.pawar)\
**Post date:** [January 28, 2025, 12:39pm UTC](https://forum.inductiveautomation.com/t/navigate-to-new-view-from-onauthchallengecompleted-event-script/101487/1 "2025-01-28T12:39:57Z")

</div>

Hello team,  
Im trying to navigate to another view after **onAuthChallengeCompleted** event script to but its not working for me.  
Anyone can help me on that?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/3/437ffb9a1f054ca28b918818f6a6a5a29f817aba.png)

---

<div class="post-metadata">

**Author:** ![Fran\_Dujmovic](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/fran_dujmovic/32/70280_2.png) [@Fran\_Dujmovic](https://forum.inductiveautomation.com/u/Fran_Dujmovic)\
**Post date:** [January 28, 2025, 12:46pm UTC](https://forum.inductiveautomation.com/t/navigate-to-new-view-from-onauthchallengecompleted-event-script/101487/2 "2025-01-28T12:46:21Z")

</div>

First thing's first - learn to post code snippets.

Secondly, **onAuthChallengeCompleted** event runs in the gateway scope but you're trying to access it via a function in the session scope. You'd need to implement the session ID in your script.

---

<div class="post-metadata">

**Author:** ![dhiraj.pawar](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@dhiraj.pawar](https://forum.inductiveautomation.com/u/dhiraj.pawar)\
**Post date:** [January 28, 2025, 2:45pm UTC](https://forum.inductiveautomation.com/t/navigate-to-new-view-from-onauthchallengecompleted-event-script/101487/3 "2025-01-28T14:45:24Z")

</div>

Hi @Fran_Dujmovic,  
Thanks for suggestion, I have tried to implement session Id but I'm getting error:

> Channel is not set.

I have attached code:

```python
def onAuthChallengeCompleted(session, payload, result):
	if result.isSuccess():
		# Parse information about the successful result
		success = True
		context = result.getAsSuccess().getContext()
		user = context.user
		roles = user.roles
		

		
			
		AllSession= system.perspective.getSessionInfo()
		for user_session in AllSession:
			if user_session.id==session.props.id:
				page_ids=user_session.pageIds
				for page_id in page_ids:
					logger = system.util.getLogger("Authentication Challenge-Roles")
					logger.info("%s is session_id"% user_session.id)
					logger = system.util.getLogger("Authentication Challenge-Pageid")
					logger.info("%s is page_id"% page_id)
					
		
					system.perspective.navigate(view='User Management/RoleConfiguration',sessionId=user_session.id,pageId=page_id)
	    

```

Please help me to implement session id?

---

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [January 28, 2025, 3:16pm UTC](https://forum.inductiveautomation.com/t/navigate-to-new-view-from-onauthchallengecompleted-event-script/101487/4 "2025-01-28T15:16:50Z")

</div>

First, we can start by changing

```python
AllSession= system.perspective.getSessionInfo()

```

to just use the `session` parameter that's already provided for you in the function.

Are you actually trying to redirect every tab a person may have open to the User Management/RoleConfiguration view after a successful authentication? Seems a little bit odd, but this could be a customer requirement.

[Here](https://docs.inductiveautomation.com/docs/8.1/ignition-modules/perspective/scripting-in-perspective/perspective-session-events-scripts#authentication-challenge-parameters) is a very helpful docs page that goes into this a little bit.

---

<div class="post-metadata">

**Author:** ![dhiraj.pawar](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@dhiraj.pawar](https://forum.inductiveautomation.com/u/dhiraj.pawar)\
**Post date:** [January 29, 2025, 12:10pm UTC](https://forum.inductiveautomation.com/t/navigate-to-new-view-from-onauthchallengecompleted-event-script/101487/5 "2025-01-29T12:10:18Z")

</div>

Hello @YF129701 ,  
Yes, after successes full authentication user will navigate to respective screen. But currently im unable to navigate due to facing error

---

<div class="post-metadata">

**Author:** ![Fran\_Dujmovic](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/fran_dujmovic/32/70280_2.png) [@Fran\_Dujmovic](https://forum.inductiveautomation.com/u/Fran_Dujmovic)\
**Post date:** [January 29, 2025, 12:52pm UTC](https://forum.inductiveautomation.com/t/navigate-to-new-view-from-onauthchallengecompleted-event-script/101487/6 "2025-01-29T12:52:47Z")

</div>

> [@dhiraj.pawar](#):
>
> But currently im unable to navigate due to facing error

Can you post a screenshot of the error you're facing?
