Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facebook doesn't accept OAuth Redirect URI specified by tutorial #76

Open
tomprogers opened this issue Feb 17, 2017 · 1 comment
Open

Comments

@tomprogers
Copy link

Per the instructions in the readme, I tried to register a new OAuth Redirect URI via Facebook's dev site. Here's the relevant part:

Before we leave the Facebook settings, we need to tell Facebook we have a new redirect url to register. Navigate to the bottom of the page and add the following into the bundle ID field:

fb{YOUR_APP_ID}

We'll need to create a new URL scheme for Facebook and (this is a weird bug on the Facebook side) the facebook redirect URL scheme must be the first one in the list. The URL scheme needs to be the same id as the Bundle ID copied from above.

Facebook won't accept the new redirect URL scheme. It says:

[0] should represent a valid URL

screen shot 2017-02-16 at 8 06 37 pm

I know this isn't exactly a bug in react-native-oauth, but it certainly suggests the instructions in this repo are no longer accurate, which seems like a valid doc issue.

@SailingSteve
Copy link
Contributor

SailingSteve commented Oct 11, 2017

I got it working.

For iOS don't bother trying to add a URL at all on Facebook Login/Settings/"Valid OAuth redirect URIs" field. That field will not accept a iOS scheme, only http:// or https:// schemes.

Instead go to https://developers.facebook.com/apps/<your id>/settings/

If you do not have an "iOS" platform, click that "+ Add Platform" button at the bottom, and add iOS. For both the "Bundle ID" and "URL Scheme Suffix (Optional)" add the fb{YOUR_APP_ID} as suggested.

screen shot 2017-10-11 at 2 59 39 pm

Then in XTools, setup your scheme

screen shot 2017-10-11 at 3 00 57 pm

and in React,

    oauthManager.configure({
      twitter: {
        consumer_key: WebAppConfig.SOCIAL_AUTH_TWITTER_KEY,
        consumer_secret: WebAppConfig.SOCIAL_AUTH_TWITTER_SECRET,
        callback_url: (Platform.OS === 'ios') ? "wevotetwitterscheme://twitter_sign_in" : "http://localhost/twitter",
      },
      facebook: {
        client_id:  WebAppConfig.SOCIAL_AUTH_FACEBOOK_KEY,
        client_secret:  WebAppConfig.SOCIAL_AUTH_FACEBOOK_SECRET,
        callback_url: "fb1097389196952441://authorize",
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants