web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Sign in page as the la...
Power Pages
Unanswered

Sign in page as the landing page

(1) ShareShare
ReportReport
Posted on by

Hello,

 

All the pages on my power pages are restricted to a specific user, including the home page. I want to direct the user to the sign-in page when they enter the URL https://mywebsite.powerappsportals.com or https://mywebsite.powerappsportals.com/SignIn. I have added this code to the header to redirect them:

 

{% if user %}
Hello, {{ user.fullname }}!
{% else %}
<script type="text/javascript">
if (window.location.pathname != "/SignIn") {
window.location.assign("/SignIn?ReturnUrl=%2F");
}
</script>
{% endif %}
 
however, it always shows the access denied page and then the sign-in page, which looks very unprofessional. I want it to just land on the sign-in page first. Can anyone explain why?
 
Thank you in advance!
Categories:
I have the same question (0)
  • Fubar Profile Picture
    8,487 Super User 2026 Season 1 on at

    You can do this be creating Web Page Access Control Rule(s)  set to "Restrict Read" for the pages that are not anonymous. 

    https://learn.microsoft.com/en-us/power-platform/admin/powerapps-flow-licensing-faq#access-to-my-website-is-authenticated-however-it-has-an-anonymous-log-in-page-do-i-need-to-purchase-an-anonymous-user-subscription

    https://learn.microsoft.com/en-us/power-pages/security/page-security

    In addition, if not using local login and you are using only 1 identity provider (e.g. Azure AD, Azure B2C etc ) you can also set it to the default, and it will push the user straight to the identity provider sign-in (avoids the user having to press the button on the portal sign-in page)

    https://learn.microsoft.com/en-us/power-pages/security/authentication/configure-site#set-a-default-identity-provider

  • poweruser38 Profile Picture
    4 on at

    Have you tried applying permissions to the Home page?

  • setzav Profile Picture
    on at

    I did that but the issue is, that it shows access denied very briefly before showing the login page. I changed it to make my home available to all users and hide elements based on the user that logs in.

     

    Thanks for the reply!

  • setzav Profile Picture
    on at

    I did that but the issue is, that it shows access denied very briefly before showing the login page. 

  • ragavanrajan Profile Picture
    7,044 Most Valuable Professional on at

    Hi @setzav 

     

    The answer is already provided by @Fubar. If you are confident with your implementation. All you need is to clear the cache and try again.  Link here 

     

    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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
rezarizvii Profile Picture

rezarizvii 64

#2
DP_Prabh Profile Picture

DP_Prabh 34

#3
oliver.rodrigues Profile Picture

oliver.rodrigues 30 Most Valuable Professional

Last 30 days Overall leaderboard