14

I am handling OAuth requests in my iOS React Native application. This application is contained and launched through Expo. I want to add in a custom callback url, so that I can return back to the application after jumping into a browser. Supposedly, I do this through modifying the info.plist file, except it is nowhere to be found. My project folder does not contain this file anywhere and I am not entirely sure if npm, the command line tool, is generating it on runtime.

Where on earth is this file?

For context, I am not using Xcode. I am just using sublime to edit my project files with a terminal running npm start.

Edit - After the solution was found:

There is another question on StackOverflow that aims to answer this same question, but for different reasons: "Info.plist file for react native ios app using expo SDK." However, my question is specific to callback urls. As I described in my answer below, Expo has its own callback URL for your app (i.e. no need to edit the info.plist file). If you need that info.plist, see the question linked above. The info.plist file is hidden when using Expo, but there is a work around to accessing some of its fields.

Code Doggo
  • 1,700
  • 4
  • 25
  • 51
  • are you using expo? – Shubhnik Singh Oct 30 '17 at 12:49
  • @ShubhnikSingh Yes – Code Doggo Oct 30 '17 at 12:53
  • 1
    Than you won't have info.plist. Your project will not contain any native files like info.plist, .gradle files for android. – Shubhnik Singh Oct 30 '17 at 12:54
  • Is there anyway to add in a callback url? Or am I out of luck? – Code Doggo Oct 30 '17 at 12:54
  • If you have to use native code than you should eject from the expo app to a regular react-native project. – Shubhnik Singh Oct 30 '17 at 12:55
  • Wait, pardon my confusion here, but is coding and running through Expo not a "regular" react native application? I thought this was just a testing method. – Code Doggo Oct 30 '17 at 12:56
  • 1
    I have no experience with expo, check if this can help you https://docs.expo.io/versions/latest/guides/linking.html – Shubhnik Singh Oct 30 '17 at 12:57
  • 1
    there are two ways to create your RN app: 1) create-react-native-app(expo) : You can only code in Javascript, there isn't any native files 2) react-native init(using react-native CLI): You can add native files. – Shubhnik Singh Oct 30 '17 at 12:59
  • Possible duplicate of [Info.plist file for react native ios app using expo SDK](https://stackoverflow.com/questions/48157185/info-plist-file-for-react-native-ios-app-using-expo-sdk) – Lucio Mar 30 '19 at 04:19
  • @Lucio So, the question you linked to isn't quite what my original question was trying to get to. I addressed this in my now updated question above, but back then, I had been told that custom callback URLs were done through `info.plist`, which they are normally, but when you are using Expo, they are **not**. Expo does things differently and hides the `info.plist` file entirely (as described in your linked question). For custom callback URLs, use my answer below (which it looks like you are). If you need to access other fields in `info.plist`, then definitely see your linked question! – Code Doggo Mar 30 '19 at 05:18

2 Answers2

8

For non-Expo projects, the location is /YOUR_APP_DIR/ios/YOUR_APP_NAME/Info.plist. If you update this file and save, you will see the same file update in Xcode.

Sun Lee
  • 559
  • 2
  • 5
  • 16
  • For Expo: https://stackoverflow.com/questions/48157185/info-plist-file-for-react-native-ios-app-using-expo-sdk – Lucio Mar 30 '19 at 04:19
  • For anyone else reading this, I addressed this linked question in the comment section of my original question and in the question itself as a response to if this is a *possible duplicate*. – Code Doggo Mar 30 '19 at 05:25
2

Shubhnik Singh truly helped me out here. For anyone wondering, go here: https://docs.expo.io/versions/latest/workflow/linking/

More specifically, look at the Expo.Linking module section. Instead of creating your own callback url link, you are borrowing Expo's. You are, after all, running everything from with inside another app, so it wouldn't make sense to have your own true callback link.

In all, you do have a callback link that Expo gives you.

Edit: Saturday, March 30th, 2019

As reported in the comments, the original link to the Linking guide is dead. But, it only appears like Expo moved around some stuff on their domain. It is apparent that some of the actually details have slightly been changed (see WayBackMachine's snapshot of the original page). Specifically relating to this question, the callback URL specifics and the names on the actual guide have changed slightly. I have updated my original answer above to reflect this.

Code Doggo
  • 1,700
  • 4
  • 25
  • 51
  • 1
    The link is 404 now... Unfortunately I can't make HTTP requests because this config file is missing :( – Lucio Mar 30 '19 at 04:17
  • @Lucio I just updated my answer above with the correct and working links now. Thanks for telling me. The answer is now functional again. See my edit remarks in the above answer, but basically Expo moved around some stuff on their domain. The guide just got moved slightly. – Code Doggo Mar 30 '19 at 04:40