{"id":181,"date":"2022-01-06T11:18:22","date_gmt":"2022-01-06T11:18:22","guid":{"rendered":"https:\/\/blog.citrus-lime.com\/crmc\/?p=181"},"modified":"2022-01-06T11:18:22","modified_gmt":"2022-01-06T11:18:22","slug":"part-4-power-apps-portals-styling-azure-b2c-for-power-apps-portals","status":"publish","type":"post","link":"https:\/\/blog.citrus-lime.com\/crmc\/part-4-power-apps-portals-styling-azure-b2c-for-power-apps-portals\/","title":{"rendered":"Part 4 \u2013 Power Apps Portals: Styling Azure B2C for Power Apps Portals"},"content":{"rendered":"\n<div class=\"wp-block-image\"><figure class=\"alignright is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/azure.microsoft.com\/svghandler\/active-directory-b2c?width=600&amp;height=315\" alt=\"See the source image\" width=\"337\" height=\"177\" \/><\/figure><\/div>\n\n\n\n<p>When we configure an App or Website to authenticate via Azure B2C \u2013 this will give us a vanilla Log In and Sign-up Page.<\/p>\n\n\n\n<p>We will often want to customize this page and define the appearance according to our intended content and not just the default.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_724B7746.png\" alt=\"image\" title=\"image\" \/><\/figure>\n\n\n\n<p>We can do this by editing the Settings for the Azure B2C User Flow in question \u2013 specifically the\u00a0<strong>Page Layouts<\/strong>\u00a0for that User Flow.<\/p>\n\n\n\n<p>Initially this will be set to \u2018Use custom page content\u2019 as NO \u2013 but we can change this to YES and set where this Custom Page Content should come from.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_32155DCC.png\" alt=\"image\" title=\"image\" \/><\/figure>\n\n\n\n<p>We need to ensure that for each Layout Name we change \u2018Use custom page content\u2019 to YES for each of the layouts for the user flow.<\/p>\n\n\n\n<p>This will mean that whatever route the user goes down in this user flow, the style of the page will stay consistent. We can copy the same custom page URI for each one of these layouts.<\/p>\n\n\n\n<p>Now when we think of using Power Apps Portals, we want this Custom Page URL to be supplied from the Portal Content held in our Dynamics Portal.<\/p>\n\n\n\n<p><strong>Specifically a Page that is ready to merge the content in our Portals with the content produced by Azure B2C:<br><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_34BE197D.png\" alt=\"image\" title=\"image\" \/><\/figure>\n\n\n\n<p>In the example above, this is following the default format of:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Page &#8211;&nbsp;<\/strong>Page in Portal Management to define the partial URL of \/azure-ad-b2c-sign-in<\/li><li><strong>Page Template &#8211;&nbsp;<\/strong>This connects to a Page Template so this can be used across multiple Pages<\/li><li><strong>Web Template &#8211;&nbsp;<\/strong>The Page Template connects up to a Web Template that handles the HTML that will be read from the Power Apps Portal, merged with Azure B2C and then presented from Azure B2C to the user.<\/li><\/ul>\n\n\n\n<p>This means that the Web Template can be designed and built in Power Apps Portals and then used in however many Pages we need the same base Template for.<\/p>\n\n\n\n<p>Now \u2013 the unique content for the User Flow is actually generated by Azure B2C and then \u2018fed into\u2019 our Web Page + Template Html.<\/p>\n\n\n\n<p>This often means we can define the broad Styling and Frame for our page in the Web Template \u2013 use this Web Template in our Pages \u2013 so each unique Page we connect into Azure B2C is mainly just giving us a different partial URL.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_74880002.png\" alt=\"image\" title=\"image\" \/><\/figure>\n\n\n\n<p><strong>Viewing the the Pages connected with our Page Template and Web Template.<\/strong><\/p>\n\n\n\n<p>The Page Content is then just the basics to define the Page and insert any unique HTML Content only if required:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_1B561643.png\" alt=\"image\" title=\"image\" \/><\/figure>\n\n\n\n<p><strong><br><br>Defining a New Password Page in the same way<\/strong><\/p>\n\n\n\n<p>This page can then be likewise configured into one of the Azure B2C User Flows:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_090D4F81.png\" alt=\"image\" title=\"image\" \/><\/figure>\n\n\n\n<p><strong><br><br>Connecting the Change Password Page for the B2C Password Reset User Flow to the Content in Power Apps Portals<\/strong><\/p>\n\n\n\n<p>For the HTML part of this, we need to look at our Web Template. Microsoft has an article providing a sample section of source HTML you can copy and paste as a base here:&nbsp;<a href=\"https:\/\/docs.microsoft.com\/en-us\/powerapps\/maker\/portals\/configure\/azure-ad-b2c\">https:\/\/docs.microsoft.com\/en-us\/powerapps\/maker\/portals\/configure\/azure-ad-b2c<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_2FDB65C1.png\" alt=\"image\" title=\"image\" \/><\/figure>\n\n\n\n<p><strong><br><br>Web Template using sample Microsoft source HTML<\/strong><\/p>\n\n\n\n<p>It\u2019s not required to go down this route however, you can build your HTML from scratch, and can amend this however you want, in order to get to the required styling for your portal.<\/p>\n\n\n\n<p>The only thing you need to ensure you have in the source HTML is a div element with \u2018id\u2019 set to \u2018api\u2019, this is where the Azure B2C functionality will be merged into your web page:<\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_5D5C8584.png\" width=\"168\" height=\"22\"><strong><br><br>The div id = api is required in your source HTML<\/strong><\/p>\n\n\n\n<p>The final thing you need to do here is set cross-origin resource sharing for your portal. We configure these in our Portal site settings.<\/p>\n\n\n\n<p>There are two portal site settings we need to define here:<\/p>\n\n\n\n<p>\u00b7 HTTP\/Access-Control-Allow-Methods: GET,OPTIONS<\/p>\n\n\n\n<p>\u00b7 HTTP\/Access-Control-Allow-Origin: https:\/\/[yourazureb2ctenant].b2clogin.com\/<\/p>\n\n\n\n<p>These will grant access between your Azure B2C tenant and your Portal to pass the authentication details using your custom web pages.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_6B2ECB7F.png\" alt=\"image\" width=\"533\" height=\"45\" title=\"image\" \/><\/figure>\n\n\n\n<p><strong><br>Required portal site settings for the COR<\/strong>S<\/p>\n\n\n\n<p>With all the above set up, your user will now see your custom styling when interacting with any user flow in Azure B2C via your portal.<\/p>\n\n\n\n<hr class=\"wp-block-separator\" \/>\n\n\n\n<p><strong>Next Article &gt;&gt;<\/strong><\/p>\n\n\n\n<p><strong><a rel=\"noreferrer noopener\" href=\"https:\/\/www.crmcs.co.uk\/content\/power-apps-portals-how-to-connect-azure-b2c-with-linkedin.aspx\" target=\"_blank\">Part 5 &#8211; How to connect Azure B2C with LinkedIn<\/a><\/strong><\/p>\n\n\n\n<p><strong>Further Reading\u2026<\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/www.crmcs.co.uk\/what-we-do\/powerapps-portals\/\"><strong>Open up new possibilities with Power Apps Portals | CRM Consultancy (crmcs.co.uk)<\/strong><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>When we configure an App or Website to authenticate via Azure B2C \u2013 this will give us a vanilla Log In and Sign-up Page. We will often want to customize this page and define the appearance according to our intended content and not just the default. We can do this by editing the Settings for<\/p>\n","protected":false},"author":43,"featured_media":43,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_price":"","_stock":"","_tribe_ticket_header":"","_tribe_default_ticket_provider":"","_tribe_ticket_capacity":"0","_ticket_start_date":"","_ticket_end_date":"","_tribe_ticket_show_description":"","_tribe_ticket_show_not_going":false,"_tribe_ticket_use_global_stock":"","_tribe_ticket_global_stock_level":"","_global_stock_mode":"","_global_stock_cap":"","_tribe_rsvp_for_event":"","_tribe_ticket_going_count":"","_tribe_ticket_not_going_count":"","_tribe_tickets_list":"[]","_tribe_ticket_has_attendee_info_fields":false,"footnotes":""},"categories":[3],"tags":[],"class_list":{"0":"post-181","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-crm"},"featured_image_src":"https:\/\/blog.citrus-lime.com\/crmc\/wp-content\/uploads\/sites\/30\/2021\/11\/Untitled-design-41.png","author_info":{"display_name":"jadesmith","author_link":"https:\/\/blog.citrus-lime.com\/crmc\/author\/jadesmith\/"},"_links":{"self":[{"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/posts\/181","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/users\/43"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/comments?post=181"}],"version-history":[{"count":1,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/posts\/181\/revisions"}],"predecessor-version":[{"id":182,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/posts\/181\/revisions\/182"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/media\/43"}],"wp:attachment":[{"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/media?parent=181"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/categories?post=181"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/tags?post=181"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}