Coder Social home page Coder Social logo

Comments (15)

vmurin avatar vmurin commented on June 25, 2024

Please refer the iOS config section in README file, especially the Attention note:

Attention: The value for CFBundleURLSchemes key should be the literal value of the Bundle Identifier with no $ variables, for example: com.my-domain.native-app

So replace you variable with the string value and it should work

I will also replace misleading example in the README :)

from react-native-azure-auth.

advaniamobile avatar advaniamobile commented on June 25, 2024

Hey man thanks for answering. So I replaced both instances of the PRODUCT_BUNDLE_IDENTIFIER variable with the actual bundle identifiers, eg: com.example.myapp. So the key CFBundleURLSchemes now has "com.example.myapp" and CFBundleIdentifier also. Unfortunately I still have the same problem. Any ideas?

from react-native-azure-auth.

vmurin avatar vmurin commented on June 25, 2024

Try to double check your app registration in Azure portal. Remove all unrelated/unused redirect URIs and leave one according to schema in README
Also you could consult my comments to the issue #20

from react-native-azure-auth.

alexstoyanov avatar alexstoyanov commented on June 25, 2024

@advaniamobile Have you found a solution to the issue? I think I got the same problem. I get to the same screen and my app closes when I click on "Continue" or "Cancel"

from react-native-azure-auth.

advaniamobile avatar advaniamobile commented on June 25, 2024

@alexstoyanov No I haven't found a solution. After a lot of debugging I decided to try out a different library.

from react-native-azure-auth.

JuanShallcrass avatar JuanShallcrass commented on June 25, 2024

I have the same problem. When using it on Android, everything works fine, but on iOS I can't complete the login process. I have checked both the BundleIdentifier and the redirect url and they seem to be correct. I even created a new Azure app from scratch with only the redirect url of iOS, but it didn't work. Any clues why this may be happening?

from react-native-azure-auth.

vmurin avatar vmurin commented on June 25, 2024

Could you please post here following:

  • AzureAuth initialization snippet
  • ...authorize() call snippet
  • CFBundleURLSchemes and CFBundleIdentifier sections of your Info.plist
  • the callback URL as you have it in the App registration on Azure (please do the screenshot)

And the last thing: what type of MS account you are using to login? Eventually you have some restrictions related to callback URL

from react-native-azure-auth.

JuanShallcrass avatar JuanShallcrass commented on June 25, 2024
  • AzureAuth:
    const azureAuth = new AzureAuth({ clientId: 'my-client-id', persistentCache: true, tenant: 'my-tenant', redirectUri: 'com.myapp.appios://com.myapp.appios/ios/callback' });

  • Authorize:
    let tokens = await azureAuth.webAuth.authorize({scope: 'User.Read Calendars.ReadWrite Calendars.ReadWrite.Shared'});

  • CFBundleIdentifier:
    <key>CFBundleIdentifier</key> <string>com.myapp.appios</string>

  • CFBundleURLSchemes:
    <key>CFBundleURLSchemes</key> <array> <string>com.myapp.appios</string> </array>

  • AppRegistration in Azure:
    Captura de pantalla 2019-12-12 a las 12 49 04

  • My AppDelegate.m:
    `#import <React/RCTLinkingManager.h>

@implementation AppDelegate

  • (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
    sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
    {
    return [RCTLinkingManager application:application openURL:url
    sourceApplication:sourceApplication annotation:annotation];
    }
    `

I'm using an educative or profesional account, but i don't think thats the issue since in Android works fine.

I have tried the url created in src/webAuth/index.js for the login in the browser, but it's the same. It like the callback url it's no being called after the user logs in.

Also tried changing the callback url to https://login.microsoftonline.com/common/oauth2/nativeclient and it was called after the login.

`const loginUrl = this.client.loginUrl(requestParams)

    console.log(loginUrl)

    let redirectUrl = await agent.openWeb(loginUrl)

   //never reaches

    console.log(redirectUrl);

`

from react-native-azure-auth.

vmurin avatar vmurin commented on June 25, 2024
  1. Try to remove redirectUri parameter from new AzureAuth(, it is anyway default
  2. Also tried changing the callback url to https://login.microsoftonline.com/common/oauth2/nativeclient and it was called after the login.

Where you have done this? In the code or in the app registration?
If in the app registration and you have checked it in the browser - all correct. The problem is - you are doing login in the browser window called from the app, and then to return back to the app, the callback with the app-url-scheme should be called plus this url-scheme should be properly bound (registered) to the app. Therefor =>

  1. Double check this section:
<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>None</string>
        <key>CFBundleURLName</key>
        <string>AzureAuth</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>com.myapp.appios</string>
        </array>
    </dict>
</array>

Any typos, any not needed additions etc

  1. What iOS version are you on?

from react-native-azure-auth.

JuanShallcrass avatar JuanShallcrass commented on June 25, 2024

Thank you very much for the response.

  1. I removed the redirectUri parameter and also the tenant and persistentCache with the same result.

  2. Just used it to test that the Azure App was working, I changed it on the code and enabled the url in Azure APP -> Authorization.

  3. I revised my app info.plist to see if there were anything different with the CFBundleURLTypes section, but I can't see what is wrong. Also tried changing the bundle identifier, the CFBundleTypeRole or even adding the CFBundleURLTypes thought xCode in Info -> URL Types but nothing worked. Should I check any other key that could be the problem?

  4. My app iOS target version is 9.0, and I'm running it on iOS 13 (Simulator 13.1 and On Device).

from react-native-azure-auth.

vmurin avatar vmurin commented on June 25, 2024

Hi @JuanShallcrass

sorry for a long silence during holidays. I got also a new project at work and have unfortunately not too much time at the moment to answers quickly :)

  1. Have you replaced the bundle identifier in the project itself? File: ios/<YOUR PROJECT>.xcodeproj
  2. Are you using the React Native Navigation? I found couple reported issues about conflicts with it. But it's only a subtile assumption...
  3. Are you using the latest RN version. For 0.60 was also reported a bug preventing the return to the app from browser login.

But the number 1) is my favorite ;)

from react-native-azure-auth.

JuanShallcrass avatar JuanShallcrass commented on June 25, 2024

Hi @vmurin

Thanks for your response. Just updated my project to the last version of react native (I was using a 0.59 version), and now the login flow is working as expected.

Thank you very much.

from react-native-azure-auth.

vmurin avatar vmurin commented on June 25, 2024

Perfekt! :)
Thank you for your feedback!

from react-native-azure-auth.

gustavohcastro avatar gustavohcastro commented on June 25, 2024

Hi,
I have the same problem in Android, iOS works fine, but it Android after a press continue or cancel both anything happens...
Someone can help me?

from react-native-azure-auth.

renishdeveloper avatar renishdeveloper commented on June 25, 2024

+1

from react-native-azure-auth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.