Skip to main content

Notifications

Power Pages - General Discussions
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:
  • ragavanrajan Profile Picture
    ragavanrajan 7,023 on at
    Re: Sign in page as the landing page

    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.

  • setzav Profile Picture
    setzav on at
    Re: Sign in page as the landing page

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

  • setzav Profile Picture
    setzav on at
    Re: Sign in page as the landing page

    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!

  • poweruser38 Profile Picture
    poweruser38 4 on at
    Re: Sign in page as the landing page

    Have you tried applying permissions to the Home page?

  • Fubar Profile Picture
    Fubar 7,688 on at
    Re: Sign in page as the landing page

    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

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,636

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,942

Leaderboard