how to give phonegap app a valid redirect uri - facebook

i am begginner in phonegap and using android studio for editing and running phonegap coding
i have to add facebook login in my phonegapp app ,for this i am using openfb.js plugin
link -- https://github.com/ccoenraets/OpenFB
sucessfully integrated all things but when running its showing me valid oauth redirect uri error
what will be "Valid OAuth redirect URIs" if my project file is saved in computer c drive and not on localhost

Related

Using a self-signed certificate with a chrome packaged app

I'm developing a Chrome packaged app (not an extension), which connects to the server over secure WebSocket. The server's certificate is self-signed, and this cannot be changed.
The problem is that on the chrome packaged app, the connection attempt fails with an ERR_INSECURE_RESPONSE error.
In the Chrome browser, there is a work-around: The browser opens a security warning page. If user chooses to continue to the website, it goes on to the remote page. However there is no such work-around in a packaged app. Instead, the connection attempt just fails.
Is there any way to code the Chrome packaged app to accept a self-signed certificate?
Found a work-around - open a browser from inside the chrome app.
This is done by using a webview HTML element (webview is the chrome app name for iframe).
Now the chrome app user can accept the security risks of using a self-signed certificate, just as the web app user does.

New preview for MSAL login redirect for Xamarin droid fails

I'm using Xamarin Forms in Visual Studio 2015 with the new MSAL preview v.1.1.0. The app calls the PublicClientApplication.AcquireTokenAsync which pulls up the login form in Chrome on the mobile device. The login is successful, but when it redirects I get the error message "This site can't be reached. The webpage at msal[my app id]://auth/?code=[auth code]... might be temporarily down or it may have moved permanently to a new web address.
When stepping through the app I see that the PublicClientApplication's redirect uri property is set to msal[my app id]://auth. And that is the same custom redirect uri that I entered into the Azure B2C tenant application.
Does anyone have any suggestions from that error of what I should check? Thanks.
OK. I figured it out. I missed the instruction in step 6b on the new sample app: https://github.com/Azure-Samples/active-directory-b2c-xamarin-native‌​. There needs to be a BrowserTabActivity added inside the application element of the AndroidManifest.xml file. See the link on github for specifics.
You should check out the Integrate Azure AD B2C into a Xamarin forms app using MSAL sample.
This issue generally has the following causes:
You haven't configured your RedirectURI correctly in your AndroidManifest.xml, double check that you've populated both the scheme and the host correctly, where scheme only includes msal[APPLICATIONID] without colon, slashes or 'auth' and the host while the host only includes 'auth'
You haven't configured your RedirectURI correctly in your MainActivity.cs, double check that it matches the full redirect URI, meaning that it does include colon, slash and 'auth' like so: msal[APPLICATIONID]://auth
You're missing the OnActivityResult method that calls the AuthenticationContinuationHelper.
You need to use Chrome which is not installed on all images inside your emulator.
Running in an Android Emulator
MSAL in Android requires support for Custom Chrome Tabs for displaying authentication prompts. Not every emulator image comes with Chrome on board: please refer to this document for instructions on how to ensure that your emulator supports the features required by MSAL.

Visual Studio 2015-Angular-Cordova-facebook login error

My Visual studio 2015 Cordova app, which uses facebook login is working fine in Ripple emulator. However, when I try to run the same app in Android emulator or in device, I get the error: “Given URL is not allowed by the Application configuration: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.".
In my facebook settings (https://developers.facebook.com) for website I have following entry:
Site URL: http://localhost:4400/
Mobile Site URL: http://localhost:4400/
In Advanced Tab, OAuth settings, both Client OAuth Login and Embedded browser OAuth Login are “yes”.
I tried with “Valid OAuth redirect URIs” keeping empty or http://localhost:4400/login
Hosts file does have an 127.0.0.1 localhost entry.
What should be the right URL in Site URL for an application in Basic and Advanced tab of http://developers.facebook.com? Wondering if these fields are ignored for a mobile app?
Like on a device, when running in the Android emulator, the Android OS believes "localhost" is the device itself rather than your PC. This is just like running Windows in a VM in this regard. Try fully qualifying your machine name or using an external IP instead.

phonegap 3.3 iOS Facebook Connect redirect_uri must be absolute

I am developing ios native application using phonegap. This application has barcodescanner and facebook connect features. I am using phonegap version 2.9.0.
The user has to login with facebook credentials when the application is launched. There is a button in the application and it will redirect to browser (safari) for asking facebook login when the button is clicked. Also, this application has facebook post feature.
It was working fine (facebook connect and barcodescanner) with phonegap version 2.9.0.
Now, facebook connect (for login) is not working after I upgrade phonegap version 3.3.0.
It says "redirect_uri must be absolute" after the browser (safari) is launched.
I am using this link. After I upgrade the phonegap version to 3.3.0, I did not change my application logic. I am using following code for facebook initialize and facebook login when the button is clicked.
Facebook init.
FB.init({ appId: "<appid>", nativeInterface: CDV.FB, useCachedDialogs: false });
Facebook login
FB.login(function(response){},{scope:"email"});
I tried changing the appid also, Same response.
I have included JS files for phonegap framework and facebook connect framework and they are loaded when the application is loaded. I am sure about it. There are no errors while building the app.
Please let me know what I am doing wrong.
--Sridhar
redirect_uri errors usually raise if you don't give the same link the one u used while creating FB app on developers page something like below.
Don't use redirect_uri in initializing or methods just add in developers page FB app. That should work.
This link could be helpfull.
but, I can't make it work the auto install
phonegap local plugin add https://github.com/mallzee/phonegap-facebook-plugin.git --variable APP_ID="[FB APP ID]" --variable APP_NAME="[FB APP NAME]"
it said to my: [error] Variable(s) missing: APP_ID, APP_NAME
This fixed it for me. Apparently cordova failed to copy the APP_ID and APP_NAME variables from the plugin config into the .plist so I had to go in and edit the .plist file that cordova build generates with the value of the variables.
Under platform/ios/<appname>/<appname>-Info.plist search for $APP_ID and $APP_NAME in that file, and replace them with their values.
After doing that the login worked normally.

FB canvas app Chrome and https

Why chrome is not showing my canvas application on facebook ?
It will show it when you surft direct to it om our domain. But it will give the error below when accessing it it through the apps.facebook.com domain.
We are running on a self signed certificate. Using Firefox on fb canvas app gives you an option if i want to continue surfing an insecure site. Chrome will show an error with no options.
This webpage is not available
might be temporarily down or it may have moved permanently to a new web address.
Error 501 (net::ERR_INSECURE_RESPONSE): Unknown error.
Google chrome version 16.0.912.63 m
Had the same problem and solved it by going to my local canvas site, exported the certificate (as p7b) and imported it again into Chrome. There was an older local certificate installed, maybe that was the problem.