Developer forum

Forum » CMS - Standard features » Externet and Azure B2C

Externet and Azure B2C

Daniel Hollmann
Reply

Hi.

We have some problems using the external authentication – using Azure B2C.
We don’t need to use B2C login to get into the backend/admin area, only to be authenticated frontend users.
 

We have followed this guide thoroughly. https://doc.dynamicweb.com/documentation-9/users/external-authentication/azure-b2c

 

After we have set this up, we have used the Externet app  https://doc.dynamicweb.com/documentation-9/users/user-management/extranet

 

Here we can login using our accounts we have set up in Dynamicweb, and protect pages using DWs permission model. However there does not seem to be any action towards our Azure B2C directory, and all we get is “incorrect username or password”, and there is nothing to be seen in our logs. We have tried to check the debug mode in Settings -> Control Panel -> External Authentication.

 

Are there something we are missing in the setup, or is there more to it than what the guide provides?

Our current solution runs on 9.10.14 and we are using Swift.

Best regards
Daniel


Replies

 
Nicolai Pedersen
Reply

Hi Daniel

Did you make any changes to the login template? Swift does currently not have template support for the azure login button that is required...

BR Nicolai

 
Daniel Hollmann
Reply

Hi again.


No currently we only use the login.html template, that is default. Anyway we are not afraid of doing a bit of customization, if we can find the right resources 😊

 

 
Nicolai Pedersen
Reply

Yes, I can see the missing link in the docs.

Azure b2c is part of external authentication - and the bit of template logic needed can be found here:

https://doc.dynamicweb.com/documentation-9/users/external-authentication/external-authentication

 
Daniel Hollmann
Reply

Ahh okay, yes. That is definitely missing in our soultion, we will take a look at that, and check back here, if we see more problems!

 

Thanks!

 
Kasper Laursen
Reply

Hi Nicolai,

I work with Daniel and we're still having trouble making this work. We added the proper template logic, but get the following error.

I've miticulously went through the guide in your documentation to make sure I haven't missed anything. That's no guarantee of course, but could you help us along? There's not really any way of knowing what's going wrong as far as I can tell.

Regards,
Kasper

 
Nicolai Pedersen
Reply

The "unable to obtaing configuration from" is an azure b2c exception.

Can you show your configuration of your External Login provider in DW and your settings on Azure?

BR Nicolai

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Kasper,

I have posted a similar issue a few weeks ago: https://doc.dynamicweb.com/forum/cms-standard-features/cms-standard-features/azure-b2c-login-issues

In my case, I have solved it by downgrading to 9.10.x and I have not tested yet if the latest 9.12 version had it fixed.

Maybe the details from Oleg may be helpful for you.

Adrian

 
Kasper Laursen
Reply

@Adrian
Thanks, I'll look into that later on. I'm currently on 9.10.14.

 

@Nicolai
Here are my settings.

 

 
Nicolai Pedersen
Reply

Are you running on the local environment? I can see you have local hosts.

I do not think you cannot run this without SSL... It can also be a CORS issue so cookies are not send back and forth.

BR Nicolai

 
Kasper Laursen
Reply

We're not running on local environment. We're running on an azure web app.

We have currently configured and set up B2C for several other web apps and applications. This one is the only one giving us trouble.

 
Viktor Letavin Dynamicweb Employee
Viktor Letavin
Reply
This post has been marked as an answer

Hi,

Could you please try to remove Redirect page setting? otherwise you need to add exact frontend url of selected page into azure whitelist.

Another thing I would like ask you to do is change tennant setting at DW provider side from 'your-b2c-tenant.onmicrosoft.com' into 'your-b2c-tenant.b2clogin.com'.

BR, Viktor.

Votes for this answer: 1
 
Kasper Laursen
Reply

Thank you for your input Viktor. I have now got it working.

I had to enable Access tokens rather than ID tokens on the App registration to get things working.


This is in contrast to what the guide here tells me to do: https://doc.dynamicweb.com/documentation-9/users/external-authentication/azure-b2c

In any case, things are working now with one, rather significant, problem:
If i choose to abort the signup/signin process by clicking the back button in my browser, the entire site is unreachable. Every link i now click sends me back to the signun/signin page.

Another, less important issue is that if anything goes wrong during the signup/signin process (like when i click sign up and then cancel), i get redirected back to dw, but receive a 404.

And another question: How do I log out?
I am currently using this url: <baseurl>/Admin/Public/ExtranetLogoff.aspx?action=logout&providerID=1
It works fine in the sense that i get logged out from DW, but when i click login it instantly logs me in again. As you can see from my settings further op in this thread, I have enabled 'Logout from Azure on extranet logout' which I would assume prevents this issue.

Hope some of you can help me sort these things out.

Regards,
Kasper

 
Daniel Hollmann
Reply

Is there any way to get the JWT token used to authenticate, when the user is logged into Azure  b2c. We need to use that token to call an external API?
All I get when I'm logged in is a cookie called ".AspNet.ExternalCookie"

Is the DW -> Azure B2C even using the JWT token?

 
Viktor Letavin Dynamicweb Employee
Viktor Letavin
Reply

Hi,

The token used internaly by Owin api.

BR, Viktor.

 
Kasper Laursen
Reply

Hi again,

I'm going to sum up our above issues and try to be as clear as possible. Please do help us out.

For all of our issues, the configuration is as given in my above two posts.

Our current issues, in order of importance:

1.
How do we get the access token for use in external API calls?

2.
How do i log out?
If i use this url: <baseurl>/Admin/Public/ExtranetLogoff.aspx?action=logout&providerID=1, the use get's logged out of DW, but is not logged out from B2C, which means that the next time i click log in i get instantly logged in. I have enabled 'Logout from Azure on extranet logout' in the B2C configuration.

3.
When I go to the Signupsignin flow in azure and i click the back button in my browser, the entire site becomes unusable. Every link i clicl from now on sends me to the signup-signin flow. This is rather problematic as most of our site is actually open. What can I do to fix this?

4.
Errors during the signin process in B2C returns to a 404 in DW. Is there something more I need to setup.


Some of these issues are minor, but something that should have a solution. Our first issue is of utmost importance. It will be a deal breaker for other projects in the future if there is no solution to this.
 

Regards,
Kasper

 
Viktor Letavin Dynamicweb Employee
Viktor Letavin
Reply

Hi,

According to your issues:

1) I guess you can not, could you please clarify what you want to do with the token. As far as I understand currently non of our external providers able to be used like that.

2) What providers version are you using, specifically Dynamicweb.Content.Social.Adapters.ExternalAuthentication and Dynamicweb.Content.Social.Adapters.ExternalAuthentication.Azure could you try to update them and check again?

3) This is probably a bug, I'll try to reach someone to register as a task to be solved.

4) What errors during signin process are you refering to? Could you please specify steps and environment set up so we can investigate it further.

BR, Viktor.

 

You must be logged in to post in the forum