getting an error trying to fetch token from Azure AD B2C












0















i created a separate xamarin app and trying to fetch token after login. I am following code snippet similar to what is mentioned here



https://azure.microsoft.com/en-us/resources/samples/active-directory-b2c-xamarin-native/



in my Tenant settings are like this



enter image description here



my redirect URL is also formatted properly like



 PCA.RedirectUri = $"msal{GlobalSetting.Instance.ClientID}://auth";


but



IEnumerable<IAccount> accounts = await App.PCA.GetAccountsAsync();
AuthenticationResult ar = await App.PCA.AcquireTokenAsync(GlobalSetting.Instance.Scopes, GetAccountByPolicy(accounts, GlobalSetting.Instance.PolicySignUpSignIn), App.UiParent);


this call takes me to Azure AD b2c pages and i have configured facebook there. After going through the facebook login it shows me the error



this big url and then
"could not be loaded because
net:ERR_UNKNOWN_URL_SCHEME"



enter image description here



my android manifest file looks like this



    <application android:label="HaveThat" android:roundIcon="@mipmap/icon">
<application>
<activity android:name="microsoft.identity.client.BrowserTabActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="msald6b07784-0e3a-483a-9exxxxxxc524ed1d" android:host="auth" />
</intent-filter>
</activity>
</application>
<provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"></meta-data>
</provider>
</application>


UPDATE



after removing the inner application block its not showing the web page with error. instead it is showing a blank screen in my application and next line in the code is also not hitting.



enter image description here










share|improve this question

























  • Have you configured the Android and/or iOS project with the msalXXX://auth redirect URI? See steps 6a and 6b in the referenced article.

    – Chris Padgett
    Nov 18 '18 at 5:41











  • yes check my update. i dont have "//auth" at the end though.

    – Raas Masood
    Nov 18 '18 at 5:48











  • i also observed that i am using 2 application blocks ? may be thats the problem

    – Raas Masood
    Nov 18 '18 at 6:00
















0















i created a separate xamarin app and trying to fetch token after login. I am following code snippet similar to what is mentioned here



https://azure.microsoft.com/en-us/resources/samples/active-directory-b2c-xamarin-native/



in my Tenant settings are like this



enter image description here



my redirect URL is also formatted properly like



 PCA.RedirectUri = $"msal{GlobalSetting.Instance.ClientID}://auth";


but



IEnumerable<IAccount> accounts = await App.PCA.GetAccountsAsync();
AuthenticationResult ar = await App.PCA.AcquireTokenAsync(GlobalSetting.Instance.Scopes, GetAccountByPolicy(accounts, GlobalSetting.Instance.PolicySignUpSignIn), App.UiParent);


this call takes me to Azure AD b2c pages and i have configured facebook there. After going through the facebook login it shows me the error



this big url and then
"could not be loaded because
net:ERR_UNKNOWN_URL_SCHEME"



enter image description here



my android manifest file looks like this



    <application android:label="HaveThat" android:roundIcon="@mipmap/icon">
<application>
<activity android:name="microsoft.identity.client.BrowserTabActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="msald6b07784-0e3a-483a-9exxxxxxc524ed1d" android:host="auth" />
</intent-filter>
</activity>
</application>
<provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"></meta-data>
</provider>
</application>


UPDATE



after removing the inner application block its not showing the web page with error. instead it is showing a blank screen in my application and next line in the code is also not hitting.



enter image description here










share|improve this question

























  • Have you configured the Android and/or iOS project with the msalXXX://auth redirect URI? See steps 6a and 6b in the referenced article.

    – Chris Padgett
    Nov 18 '18 at 5:41











  • yes check my update. i dont have "//auth" at the end though.

    – Raas Masood
    Nov 18 '18 at 5:48











  • i also observed that i am using 2 application blocks ? may be thats the problem

    – Raas Masood
    Nov 18 '18 at 6:00














0












0








0








i created a separate xamarin app and trying to fetch token after login. I am following code snippet similar to what is mentioned here



https://azure.microsoft.com/en-us/resources/samples/active-directory-b2c-xamarin-native/



in my Tenant settings are like this



enter image description here



my redirect URL is also formatted properly like



 PCA.RedirectUri = $"msal{GlobalSetting.Instance.ClientID}://auth";


but



IEnumerable<IAccount> accounts = await App.PCA.GetAccountsAsync();
AuthenticationResult ar = await App.PCA.AcquireTokenAsync(GlobalSetting.Instance.Scopes, GetAccountByPolicy(accounts, GlobalSetting.Instance.PolicySignUpSignIn), App.UiParent);


this call takes me to Azure AD b2c pages and i have configured facebook there. After going through the facebook login it shows me the error



this big url and then
"could not be loaded because
net:ERR_UNKNOWN_URL_SCHEME"



enter image description here



my android manifest file looks like this



    <application android:label="HaveThat" android:roundIcon="@mipmap/icon">
<application>
<activity android:name="microsoft.identity.client.BrowserTabActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="msald6b07784-0e3a-483a-9exxxxxxc524ed1d" android:host="auth" />
</intent-filter>
</activity>
</application>
<provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"></meta-data>
</provider>
</application>


UPDATE



after removing the inner application block its not showing the web page with error. instead it is showing a blank screen in my application and next line in the code is also not hitting.



enter image description here










share|improve this question
















i created a separate xamarin app and trying to fetch token after login. I am following code snippet similar to what is mentioned here



https://azure.microsoft.com/en-us/resources/samples/active-directory-b2c-xamarin-native/



in my Tenant settings are like this



enter image description here



my redirect URL is also formatted properly like



 PCA.RedirectUri = $"msal{GlobalSetting.Instance.ClientID}://auth";


but



IEnumerable<IAccount> accounts = await App.PCA.GetAccountsAsync();
AuthenticationResult ar = await App.PCA.AcquireTokenAsync(GlobalSetting.Instance.Scopes, GetAccountByPolicy(accounts, GlobalSetting.Instance.PolicySignUpSignIn), App.UiParent);


this call takes me to Azure AD b2c pages and i have configured facebook there. After going through the facebook login it shows me the error



this big url and then
"could not be loaded because
net:ERR_UNKNOWN_URL_SCHEME"



enter image description here



my android manifest file looks like this



    <application android:label="HaveThat" android:roundIcon="@mipmap/icon">
<application>
<activity android:name="microsoft.identity.client.BrowserTabActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="msald6b07784-0e3a-483a-9exxxxxxc524ed1d" android:host="auth" />
</intent-filter>
</activity>
</application>
<provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"></meta-data>
</provider>
</application>


UPDATE



after removing the inner application block its not showing the web page with error. instead it is showing a blank screen in my application and next line in the code is also not hitting.



enter image description here







azure xamarin azure-ad-b2c






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 18 '18 at 6:06







Raas Masood

















asked Nov 16 '18 at 15:22









Raas MasoodRaas Masood

388324




388324













  • Have you configured the Android and/or iOS project with the msalXXX://auth redirect URI? See steps 6a and 6b in the referenced article.

    – Chris Padgett
    Nov 18 '18 at 5:41











  • yes check my update. i dont have "//auth" at the end though.

    – Raas Masood
    Nov 18 '18 at 5:48











  • i also observed that i am using 2 application blocks ? may be thats the problem

    – Raas Masood
    Nov 18 '18 at 6:00



















  • Have you configured the Android and/or iOS project with the msalXXX://auth redirect URI? See steps 6a and 6b in the referenced article.

    – Chris Padgett
    Nov 18 '18 at 5:41











  • yes check my update. i dont have "//auth" at the end though.

    – Raas Masood
    Nov 18 '18 at 5:48











  • i also observed that i am using 2 application blocks ? may be thats the problem

    – Raas Masood
    Nov 18 '18 at 6:00

















Have you configured the Android and/or iOS project with the msalXXX://auth redirect URI? See steps 6a and 6b in the referenced article.

– Chris Padgett
Nov 18 '18 at 5:41





Have you configured the Android and/or iOS project with the msalXXX://auth redirect URI? See steps 6a and 6b in the referenced article.

– Chris Padgett
Nov 18 '18 at 5:41













yes check my update. i dont have "//auth" at the end though.

– Raas Masood
Nov 18 '18 at 5:48





yes check my update. i dont have "//auth" at the end though.

– Raas Masood
Nov 18 '18 at 5:48













i also observed that i am using 2 application blocks ? may be thats the problem

– Raas Masood
Nov 18 '18 at 6:00





i also observed that i am using 2 application blocks ? may be thats the problem

– Raas Masood
Nov 18 '18 at 6:00












1 Answer
1






active

oldest

votes


















0














fix was to use true as a second parameter in UIParent



           App.UiParent = new UIParent(this, true);


this tells the system to use embedded browser.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53340728%2fgetting-an-error-trying-to-fetch-token-from-azure-ad-b2c%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    fix was to use true as a second parameter in UIParent



               App.UiParent = new UIParent(this, true);


    this tells the system to use embedded browser.






    share|improve this answer




























      0














      fix was to use true as a second parameter in UIParent



                 App.UiParent = new UIParent(this, true);


      this tells the system to use embedded browser.






      share|improve this answer


























        0












        0








        0







        fix was to use true as a second parameter in UIParent



                   App.UiParent = new UIParent(this, true);


        this tells the system to use embedded browser.






        share|improve this answer













        fix was to use true as a second parameter in UIParent



                   App.UiParent = new UIParent(this, true);


        this tells the system to use embedded browser.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 18 '18 at 7:45









        Raas MasoodRaas Masood

        388324




        388324






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53340728%2fgetting-an-error-trying-to-fetch-token-from-azure-ad-b2c%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to pass form data using jquery Ajax to insert data in database?

            National Museum of Racing and Hall of Fame

            Guess what letter conforming each word