Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Pages - Power Apps Portals
Answered

Redirect to Specific Page after Login

(0) ShareShare
ReportReport
Posted on by 1,510

Hi,

 

Once user sign in using local sign in or Azure AD, user must redirect to specific page.

  • H V Profile Picture
    1,510 on at
    Re: Redirect to Specific Page after Login

    Thanks @ragavanrajan 

     

    I have tried above code and it is working.

    So, If I put below code in Home - Localized Content Web Page and it is working fine.

    $( document ).ready(function() {
     var userData = "{{user.id}}";
     if(userData != undefined && userData != null && userData != "")
     {
     $(location).attr('href', 'https://yourportal.powerappsportals.com/contact-us/');
     }
    });

     

    If I put above code in Web Page directly, then it is not working. Is there any reason?

  • Verified answer
    ragavanrajan Profile Picture
    7,036 Most Valuable Professional on at
    Re: Redirect to Specific Page after Login

    Hi @hardikv 

     

    Place the below code in your profile web page (Localised content > Custom JavaScript) or any web page depending on your business need. 

     

    $( document ).ready(function() {
     console.log(555,"Redirect check");
     $(location).attr('href', 'https://yourportal.powerappsportals.com/contact-us/');
    
    });
    
    
    

     

    Done the testing. It is redirecting to contacts page in my case. 


    Hope it helps. 
    ------------

    If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

  • H V Profile Picture
    1,510 on at
    Re: Redirect to Specific Page after Login

    Hi @ragavanrajan  & @chleverenz 

     

    Thanks for your suggestion.

     

    I have tried to modify Home Web Template and redirect to specific page. However it is not working as expected.

     

    {% if user %}
    <script>
     window.location.href='./contact-us/'
    </script>
    {% else %}
    
    <div class="wrapper-body">
     <section class="page_section section-landing">
     <div class="container">
     <div class="row ">
     <div class="col-md-12">
     <br>
     <br>
     <br>
     <br>
     <h1 class="section-landing-heading">{% editable snippets 'Home/Title' type: 'text' %}</h1><br>
     <h2 class="section-landing-sub-heading">{% editable page 'adx_summary' type: 'html', liquid: true %}</h2>
     <br>
     <br>
     </div>
     </div>
     </div>
     </section>
    
     <section class="page_section">
     <div class="layer_up">&nbsp;</div>
     <div class="container">
     <div class="content-home">
     {% include 'Page Copy' %}
     </div>
     </div>
     <div class="layer_down">&nbsp;</div>
     </section>
    <div class="push"></div>
    </div>
    
    {% endif %}

     

  • ragavanrajan Profile Picture
    7,036 Most Valuable Professional on at
    Re: Redirect to Specific Page after Login

    Hi @hardikv 

     

    The preferred and standard way is to change the liquid scripting in the Home web template. 

     

    The example below is redirecting to the "contact-us" page. 

     

    {% if user %}
    //if any user logs in
    <script>
     window.location.href='./contact-us/'
    </script>
    {% else %}
    //Home web page code, if you don't want to display the page when the user is being redirected
    {% endif %}
    //Home web page code, if you want to display the page when the user is being redirected

     

    Hope it helps. 
    ------------

    If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

  • Verified answer
    Christian Leverenz Profile Picture
    1,214 on at
    Re: Redirect to Specific Page after Login

    Hi @hardikv ,

    did you have a look on https://docs.microsoft.com/en-us/powerapps/maker/portals/liquid/liquid-objects#user ?

    In fact if there is the need for a user-specific page you could look, whether you are on the home or profilepage or whatever and in case of logged in user navigate to a page, which is somehow user-dependent.

    You could also look, whether your page referrer was the login. may be, this could help to identify, that you just logged in...

     

    Hope i got the question right, have fun,

      Christian

  • ragavanrajan Profile Picture
    7,036 Most Valuable Professional on at
    Re: Redirect to Specific Page after Login

    Hi @hardikv 

     

    Have a look at the below thread mate. 

    https://powerusers.microsoft.com/t5/Power-Apps-Portals/Redirect-after-T-amp-C/m-p/912659#M7102 

    Hope it helps. 
    ------------

    If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Pages

#1
Lucas001 Profile Picture

Lucas001 60 Super User 2025 Season 1

#2
Fubar Profile Picture

Fubar 55 Super User 2025 Season 1

#3
surya narayanan Profile Picture

surya narayanan 35