4

I followed this sample app from Integrate Azure AD B2C into an Android application and replaced the configuration parameters for my Azure AD B2C tenant, however I got the errors "contains script errors preventing it from being loaded

This is the URL that it generated, is it wrong or something? I'm new to this so I don't know much :(

login.microsoftonline.com/signintest.onmicrosoft.com/oauth2/v2.0/authorize?p=b2c_1_signin&redirect_uri=ran%3dom%lett%3ers%idk%why&client_id=clientid&response_type=code&state=_JhayuFI4QGD1bjElOHnvg&scope=openid&code_challenge=uiXfg8c9XEFiHFRvjjVSAbCiRNJf5CeXDFXXN0qlj_U&code_challenge_method=S226

I ran to this similar Stackoverflow question but I don't know what he meant by "An Azure AD B2C application should be created using the Azure AD B2C blade of the Azure Portal"

I tried to find out what it meant by myself but I didn't find anything. What does it mean?

troubledsoul
  • 69
  • 1
  • 10
  • Could you follow this [tutorial](https://learn.microsoft.com/en-us/azure/active-directory-b2c/tutorial-create-tenant) to create your Azure AD b2c? – Nancy Dec 26 '18 at 02:02
  • @NancyXiong I can't, I was only given the "necessary" parameters and is supposed to run a sign in page in an android app using them. I did not make the tenant. – troubledsoul Dec 26 '18 at 02:09

3 Answers3

5

Use F12 to check whether there is any error information in the console. My error message is ... has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

If you see this kind of error message, please make sure the host server of static custom UI html file allows CORS.

Crazy Crab
  • 694
  • 6
  • 16
1

I ran into this error and the cause was not using all lower-case characters in the CORS setup in Azure Storage. Hope it may help someone.

BRass
  • 3,698
  • 2
  • 28
  • 46
  • 1
    I had to bump this up. It was an amazingly odd answer and correct (for me). I had some upper-case letters in my Azure Storage CORS setting and doing nothing but making it all lowercase fixed it. – Kevin Fizz Jun 14 '23 at 21:07
0

An Azure AD B2C application should be created using the Azure AD B2C blade of the Azure Portal

This means you should create the Azure AD B2C app in Azure AD B2C tenant instead of Azure AD tenant. If you have not an Azure AD B2C tenant, you could create it first. Then register your app in that B2C tenant. You could strictly follow the Steps to Run.

Ref: Tutorial: Create an Azure Active Directory B2C tenant

Hope this helps.

Nancy
  • 26,865
  • 3
  • 18
  • 34
  • Thank you very much for answering. Um, can I ask a related question? About the redirect URI, in native apps- should it be a custom scheme? In my case I was given a redirect URI with a different format, like xyz:abc:mn:oauth:2.0:qrs. I was wondering if this might be the one responsible for the error. – troubledsoul Dec 26 '18 at 02:35
  • To avoid a collision with another application, we recommend using a unique scheme. The example redirect URI in this sample is: com.onmicrosoft.fabrikamb2c.exampleapp://oauth/redirect – Nancy Dec 26 '18 at 02:49
  • The redirect URI of your app, where authentication responses can be sent and received by your app. It must exactly match one of the redirect URIs you registered in the portal, except that it must be URL encoded. Read [more](https://stackoverflow.com/questions/13281084/whats-a-redirect-uri-how-does-it-apply-to-ios-app-for-oauth2-0/13308994) – Nancy Dec 26 '18 at 02:50
  • Oh, so redirect uri doesn't really when just signing in, therefore it's not the problem. still doesn't work but thank you very much for your help :D – troubledsoul Dec 26 '18 at 03:03