How to setup facebook app for localhost? - ruby-on-rails

Today, I've been trying to setup facebook app for localhost and I couldn't find the right solution for it. It was working in the past and I don't know what facebook updated with it...
Here's what I did:
I've created test app from one of my public app
In settings, I set site domain as "localhost" and site url as "http://localhost:8888/"
In settings/advanced, I set Valid OAuth redirect URIs as "http://localhost:8888/" again.
And when I try to login, I got the error message like below:
{
"error": {
"message": "Invalid redirect_uri: Given URL is not allowed by the Application configuration",
"type": "OAuthException",
"code": 191
}
}
Also I have public ip for my localhost and I tried to set it instead of localhost like "http://xx.xxx.xxx.xx:8888/" but it's still not working.
I'm really embarrased because it was working before. Can someone please help me out with this ?
Thanks in advance.

Here are the steps that worked for me getting my local app working with Facebook:
Part I:
goto developers.facebook.com
Hover over the "MyApp" drop-down to the right and click "Add an app" or click [Create an APP] if that is the only option you see.
Click "Settings" to the top left
copy 'App Id' and 'Secret Id' to FACEBOOK_APP_ID and FACEBOOK_SECRET_ID in your .env file
enter the app domain (eg: localhost or yourappname.app, etc.)
click [+ Add Platform] button on the bottom of the screen and then choose "Website". Enter http://localhost:8000
click [Save Changes]
Part II:
click [+Add Product] to the bottom left
choose Facebook Login
Click on "Settings" underneath "Facebook Login"
Enter your callback URL under Valid OAuth redirect URIs (eg: http://localhost:8000/login/facebook/callback)
Turn on OAuth login for your desired allowed device types
Click [Save Changes]
Part III:
click "App Review" near the top left of the screen
switch the "Make [your app name] public?" slider to "Yes"

Related

Password AutoFill save password SwiftUI

Good day.
I'm trying to implement a login page in SwiftUI, but I'm unable to figure out how to make the application prompt the user to save their credentials after a successful login.
This is the code for the input fields.
TextField("Phone number", text: $phoneNumber)
.keyboardType(.numbersAndPunctuation)
.textContentType(.username)
SecureField("Password", text: $password)
.keyboardType(.asciiCapable)
.textContentType(.password)
On success, an environment variable changes, and the parent component will stop rendering the login page.
I've enabled the "Autofill Credential Provider" entitlement.
What I am trying to achieve is use of the native "password manager" in
iOS, https://developer.apple.com/documentation/security/password_autofill.
When the user would submit their credentials and successfully authenticate, they should be shown a prompt like the one above, asking them if they want to save the password they used to sign in.
The problem with password autofill is not the UIKit/SwiftUI implementation. To get support in your app, the most important things to get right are:
Add "Associated Domains" capability to your app and set "Domains" to webcredentials:example.com (replacing example.com with a domain you actually own and have access to!).
On your website (accessible under the given domain) place a file named apple-app-site-association into your public accessible root directory in a folder .well-known.
You can test access using the command curl https://www.example.com/.well-known/apple-app-site-association. (Yes, HTTPS must be enabled and have a valid certificate!)
The content of the apple-app-site-association must reference your Apple Developer Team ID and the bundle identifier of your app as follows: (Team ID is "A1BC23REUG" and bundle identifier is "com.example.signin-playground")
{
"webcredentials": {
"apps": [
"A1BC23REUG.com.example.signin-playground"
]
}
}
Mark the input fields in SwiftUI using the appropriate textContentType modifier.
I have written a small example in this gist which I successfully tested.
If autofill is not working (e.g. you get only an unspecific password completion dialog), you normally have to check the bundle/team identifier and the in the apple-app-site-association file. If you changed something in the file recently, it's possible that the content is cached either on your device (so you can delete the app and reinstall it again) or it is cached in Apples CDN network (in which case you can activate an alternate mode as documented here
If the "Would you like to save this password" dialog is not appearing, you either didn't correctly setup "Associated Domains" or the iOS heuristic did not detect a relevant change in your screens.

linkedin oauth authorization fails with "Bummer, something went wrong"

Bummer, something went wrong
https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=test&redirect_uri=http://test.custom.com/abc/linkedin&state=DCEeFWf45A53sdfKef424asgTyhgTR5
when I use the above url I am getting "Bummer, something went wrong.
We're having difficulty connecting."
you need to add Sign In with LinkedIn permission in product tabs
from the app settings page go to the product tab and add Share on linkedin and Signin with linkedin to get the following permissions r_emailaddress, r_liteprofile, w_member_social
Hello I had a similar problem and I fixed it by doing this ;
You have to ensure that everything in your APP page ( https://www.linkedin.com/developer/apps ) matches the parameters in your authorization URL . SO for example in your case , https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=test&redirect_uri=http://test.custom.com/abc/linkedin&state=DCEeFWf45A53sdfKef424asgTyhgTR5 ;
You would have to ensure that your client_id in the auth URL matches the Client-Id on your APP page and also ensure that the redirect_uri you specified in your auth URL has been authorized on your app page as shown below . If you are passing in scopes as well, also ensure that they match perfectly . As you can see in the image below , my redirect_uri has been authorized from my app page .
Recreate a application after 12/15/2018 solved the problem for me.
(Any developer application created through the LinkedIn Developer Portal after December 15, 2018 automatically has access to the v2 API.) https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/migration-faq?context=linkedin/consumer/context
I ran into same issue.
Changing value of redirect_uri in linkedin app from http to https helped solved the issue. See picture below:
In your case, url should have been:
https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=test&redirect_uri=https://test.custom.com/abc/linkedin&state=DCEeFWf45A53sdfKef424asgTyhgTR5 ;
The best is to inspect how is the link generated by linkedin developer tool for you and then you just have to change the redirect url
https://www.linkedin.com/developers/tools/oauth
then "create token" then select all permission and click on "Request access token"
if you have the development window open you can see a query authorisation is done, then you can just copy this url and change the redirect_url.
]1
so for me
https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=myclientid&redirect_uri=myredirectid&scope=r_emailaddress%2Cr_liteprofile%2Cw_member_social&state=e6c0e1c8-1a35-478f-8eea-b0412a6675c9

How to Configure Facebook App For Devise/Omniauth on the current Facebook Apps site

I'm using this tutorial to setup simple OmniAuth authentication with Facebook for my Rails 4 app: http://sleekd.com/tutorials/setting-up-omniauth-authentication-with-facebook/.
The problem is that the tutorial is 3 years old and the organization of the Facebook App config site has changed significantly.
There no longer seems to be a "Site URL" box (where I would input http://localhost:3000). I also don't see "Site Domain" box (where I would input localhost).
In "Basic Settings" there is a box for "App Domains," but it won't accept localhost. Using localhost here results in the following error:
"This must be derived from Canvas URL, Secure Canvas URL, Unity Binary
URL, Site URL, Mobile Site URL, Page Tab URL or Secure Page Tab URL.
Check and correct the following domains: localhost"
Can anyone point me to where I should input these two bits of information with the most recent Facebook App config site?
You need to go into Settings on left sidebar, then + Add Platform. Choose Website and place
http://localhost:3000/
in Site Url field.
App Domains field can be blank.

How can I add localhost:3000 to Facebook App for development

I am working on a Rails 4 app. On my laptop, development is done at localhost:3000. The actual domain of the site is roomidex.com.
How can I set up a Facebook app so it works on production and development?
Here is the current configuration:
App Domains: roomidex.com
Website With Facebook Login:
Site URL: http://www.roomidex.com
When I try to do a Facebook login on localhost:3000, I get this not surprising error:
{
"error": {
"message": "Invalid redirect_uri: Given URL is not allowed by the Application configuration.",
"type": "OAuthException",
"code": 191
}
}
On the Facebook App page, click "edit App" then click "Advanced" in the left-hand navigation. Then for "Valid OAuth redirect URIs" add http://localhost:3000... or whatever you want the accepted redirect to be.
You can create a test app that's connected to your main app. On the Dashboard or Settings page for your main app. scroll down and you'll see "Test Apps" in the menu that runs down the left side of the page. The test app will inherit settings from the main app, but it will permanently be in development mode, and it will have its own ID.
More info on test apps here:
https://developers.facebook.com/docs/apps/test-apps/
The protocol for setting up an app to work on localhost has changed. After you get your test app set up, this explains the steps for setting it up to work on localhost:
https://stackoverflow.com/a/24253054/2803458
Your error is saying
localhost URL is not allowed in the application
I know, FB does not give a s**t about explaining, what do to in those moments, however, as far as I am concerned, I have found workaround.
Basically, you need to "whitelist" locahost url in your app
Here is what you are going to do
Go to the app edit/summary page
In the fourth field App Domains, you should already have roomidex.com, so add another address localhost
The urls mentioned above are only valid, if each one of them is put into tabs, where you set, how you app integrates with Facebook (website with facebook login, App on facebook, Mobile web, …)
I do this: I put my working URL, in your case roomidex.com into Website with facebook login, and my test, localhost URL, either into App on facebook or Page tab
June 2015
Go to My Apps > Settings > Basic
App Domains
localhost
Site Web
URL : http://localhost:8888/
Mobile URL : http://localhost:8888/
It didn't work with port 80 or without any port unfortunately.
Adding localhost to the Valid OAuth redirect URIs in the test app did not work for me but adding 127.0.0.1 did.
Facebook now requires "Valid OAuth redirect URIs" to be https.
To use https locally (localhost:3000), I used [ngrok][1] which allows you to use https by providing a tunnel. To do this:
I went to their website and downloaded their program
I extracted the file for the program
In my console, I went into the directory where ngrok was extracted to and entered 'grok http 3000' on my Windows machine, others may use './grok http 3000'
After entering that, ngrok provided a https address which I put into the Valid OAuth Redirect URIs field in Facebook
Then I started my server and was able to access it using that https address instead of localhost:3000
Just create two applications.
One for testing and one for release. You cannot supply the app with separate URL configurations.
Just edit your hosts file with your domain that pointing to localhost and it should work fine.

authentication dialog does not appear

I am trying use the facebook outh system to get some basic info from my user.
The problem is that when the user logs in it does not ask for any permissions. it provides a login dialog but thats it no dialog like this:
On my app settings I've set the authentication to the following:
So what am I missing here?
You should be able to see the dialog here: https://www.facebook.com/dialog/oauth?client_id=388123757870529&redirect_uri=http://localhost
Kristian,
It looks like you need to correctly setup your app domain (localhost) and your website url (http://localhost) because right now, the link you provided is giving this error:
"The specified URL is not owned by the application
Error Message: Invalid redirect_uri: Given URL is not allowed by the Application configuration."

Resources