Where is info.plist for React Native projects run in Expo for the purpose of callback URLs?
Asked Answered
S

3

19

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.

Sloop answered 30/10, 2017 at 12:41 Comment(10)
are you using expo?Amp
@ShubhnikSingh YesSloop
Than you won't have info.plist. Your project will not contain any native files like info.plist, .gradle files for android.Amp
Is there anyway to add in a callback url? Or am I out of luck?Sloop
If you have to use native code than you should eject from the expo app to a regular react-native project.Amp
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.Sloop
I have no experience with expo, check if this can help you docs.expo.io/versions/latest/guides/linking.htmlAmp
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.Amp
Possible duplicate of Info.plist file for react native ios app using expo SDKPhenology
@Phenology 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!Sloop
S
3

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.

Sloop answered 30/10, 2017 at 15:50 Comment(2)
The link is 404 now... Unfortunately I can't make HTTP requests because this config file is missing :(Phenology
@Phenology 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.Sloop
G
20

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.

Gourmont answered 2/6, 2018 at 4:19 Comment(3)
For Expo: #48157685Phenology
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.Sloop
Don't get deceived like me: xCode doesn't display file types by default, so for me the file name showed just as "Info", which I initially missed.Edlyn
S
3

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.

Sloop answered 30/10, 2017 at 15:50 Comment(2)
The link is 404 now... Unfortunately I can't make HTTP requests because this config file is missing :(Phenology
@Phenology 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.Sloop
P
0

Removing the dependency worked for me: https://i.sstatic.net/nn9Wx.png

Phipps answered 11/3, 2023 at 23:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.