Code Monkey home page Code Monkey logo

winsdkfb's Introduction

Windows SDK for Facebook

The Windows SDK for Facebook is geared towards app developers creating modern windows applications on both desktop and phone. Easily integrate Facebook Auth, Like and other Facebook Graph functionality using this SDK. Nuget package for Windows 10 available at: https://www.nuget.org/packages/winsdkfb

Features

Auth

  • Login
  • Logout
  • Login Button
  • Profile Picture control

Dialogs

  • Feed dialog
  • Request dialog
  • Send dialog

Graph

  • Custom Stories
  • Post to user’s feed
  • Upload Photo
  • Like a Page/Object

AppInstalls

  • Mobile App Installs (can be disabled by defining __NOFBAPPEVENTS__)

Supported Platforms

  • Windows 8.1+
  • Windows Phone 8.1+
  • Windows 10

Documentation

License

See the LICENSE file for licensing information.

Contributing

All pull requests should be made to the develop branch.

Privacy

https://www.microsoft.com/en-us/privacystatement/default.aspx

winsdkfb's People

Contributors

adiviness avatar alakshmi1030 avatar alanguslive avatar artlapitski avatar cristiw avatar ekalbredneb avatar hansemannn avatar igorkulman avatar jaimerodriguez avatar johanlindfors avatar khouzam avatar marcoronline avatar sparker0i avatar tedhoward avatar trays avatar yodurr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

winsdkfb's Issues

FBSession::Login UI is full-screen on Win8?

When our app launches FBSession::Login in the hosted WebView, it is a full-screen dialog for just the simple login UI. Seems excessive. Maybe it's something I can control somehow within xaml and so it just needs some documentation tips.

fyi
Our app is a pure C++ game. I just switched it to using SwapChainBackgroundPanel so that, among other things, we could use this new FB SDK. So our app does nothing in xaml except create 1 element.

WACK API Rejection

Hi,

I'm using winsdkfb in my windows phone 8.1 project. All is ok for using, but I can't pass WACK API verification process due to the use of Sleep API (Module api-ms-win-core-synch-l1-2-0.dll) when I try to finalize my project exportation.
Here is the WACK (3.3) report (in french) : Cette API n'est pas prise en charge pour ce type d'application - Api=Sleep. Module=api-ms-win-core-synch-l1-2-0.dll. Fichier=Facebook.dll.
Indeed, Sleep function is not supported in windows phone apps on windows phone 8.1 platform : https://msdn.microsoft.com/fr-fr/library/windows/desktop/ms686298%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396.

Any help ?
Thank you

Project will not build if the Solution Name / Filepath contains spaces

I was getting build errors when I added the Facebook project to my c# app, reading through the errors it appeared that it was using an unquoted filepath with spaces in it.

Solved the problem with a bit of brute force by creating a blank project with no spaces in the name. Facebook built OK and copied over to the intended project.

Nuget package currently needs to be manually built - consider hosting?

The nuget package today requires that you do a solution batch build, followed by running build-nupkg.cmd in the winsdkfb-master\winsdkfb-master\FBWinSDK\build\nuget folder. In order to reduce developer friction, it would be preferable to have this package already built and publicly hosted somewhere.

Consistent Project Naming [breaking change]

There's currently multiple names for the project:

Type Name
git repo winsdkfb
visual studio sln/proj files FBWinSDK
output binaries Facebook.*

These should all be standardized to one name. This will likely break references to the project or output binaries. Any comments on this breaking change are welcome.

codegen.cmd doesn't detect updated input files & rebuild

Low priority but it just broke our builds.

For now, I can add a quick hard-coded 'delete Generated folder' hack, either to codegen or to our build system. I looked at fixing it myself, but comparing filestamps in DOS is awful. I would switch to powershell.

Add the Async() suffix to all the asynchronous methods

The naming convention used by the Windows Runtime APIs is to mark asynchronous methods by adding the Async() suffix at the end (like GetGeopositionAsync(), PostAsync(), etc.).
Currently, some methods of the Facebook SDK are following this naming convention (like LoginAsync(), while some others not (like ShowFeedDialog(), ShowRequestsDialog(), Get(), Post(), etc.).

It would be great to have a common naming convention across all the APIs.

Make sample projects usage of SDK agree with build guidance.

As things stand, building the SDK and referencing it in an app is confusing to a developer, due primarily to the documentation. The docs state to simply add the SDK project to your solution, then add a reference to the SDK to your app project. This works well as far as it goes, but it is not how the sample apps in the repository are set up. Rather, the sample apps all refer to the SDK via the NuGet package. Instructions for building the NuGet package for the SDK have not been included in the documentation, and pre-built packages are not (yet) available either on the project site on GitHub or on nuget.org, so anyone expecting to simply open one of the samples in VisualStudio, build it and run it is going to be frustrated.

We need to a) change the way the SDK is referenced in the samples until such time as we can publish the NuGet packages, and b) add build instructions for the packages to the docs.

call of LoginAsync() crashes with ComException when called after ShareTargetActivation

I am trying to refresh the AccessToken when it is expired before letting the user share to Facebook. however, I am getting this exception in a Windows 10 UWP:

WinRT information: A COM call (IID: {638BB2DB-451D-4661-B099-414F34FFB9F1}, method index: 6) to an ASTA (thread 520) was blocked because the call chain originated in or passed through another ASTA (thread 5448). This call pattern is deadlock-prone and disallowed by apartment call control.
Additional information: A COM call to an ASTA was blocked because the call chain originated in or passed through another ASTA. This call pattern is deadlock-prone and disallowed by apartment call control.

I can call the method without any problems when the application is launched normally.

How can I get around this? I have referenced the GitHub repo which I stored locally.

Is there any way to get long-lived access tokens?

This is a very big deal. On Android & iOS, the official FB SDK somehow creates and renews long-lived access tokens. It appears that this WinRT FB SDK only grants short-lived tokens. That makes sense as it is simply a wrapper of the html FB auth flow.

Our app already contacts our server which converts this short-lived token into a long-lived token. But those still expire and it's not clear if we they auto-renew somehow. So once we implement things like FB gifting (this week) we also have to implement asking users to re-login to FB which will kill that UX funnel effectively killing FB integration for our app.

So.... if this FB SDK can one way or another handle these tokens like on Android & iOS that would be great.

Need to add a property set to JSON objects

All of the generated JSON objects defined in the SDK can have more properties than our code currently recognizes. For example, the FBPage object currently parses out the fields id, category, checkins, description, likes, link, and name. Beyond, those, however, Facebook defines a very large available schema for a page (https://developers.facebook.com/docs/graph-api/reference/page), any or all of which may be available for a given page. Developers will at some point want access to some or all of these items, if they're available, so they need to be made available through some kind of mechanism like a property set. Modifying the base template for code generation should allow us to add a property set and populate it with any unknown properties, that client apps can then query for any data they wish.

Missing info in FBUser after login

Greetings!

When using the facebook sdk to first log in with "public_profile" and "email" and then access the user using "FBSession.ActiveSession.User" there is only two requests being made.

  1. //me
  2. //%user_id%

This means that the FBUser class is only populated with ID and Name. Everything else is missing and I'm not finding anything in the documentation describing how to update the user or similar.

Am I supposed to update the FBUser using the FBSingleValue class or how is that class supposed to be populated?

Thanks in advance!
//Fabian

FBSession::Expires is always 0?

At least when I check after FBSession::LoginAsync it seems to be. However FBSession::AccessTokenData::ExpirationDate is valid, which also has me wondering why FBSession::Expires exists - just have devs get it from AccessTokenData.

UWP - SDK ignoring timezones -> returning bad accesstoken

Hello

I had made successful login earlier. My accesstoken is about to expire.
I experienced a strange behaviour.

I cannot log in now. No popup showing. i see just some logs at output when i call:
FBResult result = await sess.LoginAsync(permissions);

Console output
Access Token: *****
Token expires at ?2015?. ?október? ?27?., ?kedd, ?18?:?00?:?09
FBResult destructor
Content-Type: multipart/form-data; boundary=------------------------------fbsdk1234567890
FBResult destructor

FBResult object has an error object, thats why its result false:
_type = L"OAuthException"
_message = L"Error validating access token: The session was invalidated explicitly using an API call."

That error can be connected with wrong culturalinfo / timezone handling. I think sdk thinks that the access token is still valid while it is not valid anymore...

Token expires at ?2015?. ?október? ?27?., ?kedd, ?18?:?00?:?09
Current time : 2015.oktober 27. 16:42 CET

When i set date on local machine to 28th october, the sdk shows the popup and i could log in.

The ShowRequestsDialog() method doesn't return in a UWP app

I'm adding the Facebook SDK in a Universal Windows app based on SDK 10069 and running on Windows 10 10166.
Everything is working fine (login, Graph API, etc.). However, when I call the ShowRequestsDialog() method, it never returns.
Here is the code I'm using:

        private async void OnPostClicked(object sender, RoutedEventArgs e)
        {
            if (session.LoggedIn)
            {
                PropertySet parameters = new PropertySet();
                parameters.Add("message", "Try my application!");
                FBResult result = await session.ShowRequestsDialog(parameters);
                Debug.WriteLine(result.Object);
            }
        }

The request windows is correctly displayed and I'm able to successfully send invites. However, when I press the "Done" button and the popup is dismissed, the method doesn't return. Consequently, the line that should print in the Ouput Window the value of result.Object is never called.

Documentation for Win10 is misleading

The documentation (http://microsoft.github.io/winsdkfb/) says:

"NOTE: For Win10, you can always use the PhoneProductId from the manifest to get the WinAppId instead of having one Windows Store ID and one Windows Phone Store ID."

I think it is misleading, it might work during development but for a published app the PhoneProductId did NOT work for me, and is not used in the LoginCpp-UWP sample either.

The correct way is to go with the package SID on W10 as well.

VC Runtime libraries not referenced properly in NuGet package

When you install the current NuGet package into a managed app project, you must also add a reference to the VC Runtime for UWP projects. This may also be the case for 8.1 Universal projects, but I'm having a hard time verifying it right now.

At any rate this needs to be fixed - the NuGet package is supposed to bring in all of its dependencies automatically. The consequences of not having the VC Runtime reference are pretty dire - the app will throw a FileNotFound exception the first time you reference anything in the SDK, and FBSession.ActiveSession will be returned NULL, because the app can't load the SDK DLL.

invalid app id in C# UWP Application

I have a 100% valid app id which works with my webauthetificationbroker . I even checked once more on my facebook app dashboard.
But when i use the fb sdk to login I get an "invalid app id" error.

FQL support?

Is it possible to make FQL queries using this SDK?

I know that the last version of Facebook API where FQL is available is v2, but v2 will be supported until August 2016, so being able to make the FQL calls when porting from 8.1 to UWP would be quite helpful.

C++ UWP - FeedDialog Empty in a specific sequence

Hi,

I use the sample "LoginCpp-UWP.sln". I added a button "FeedDialob FB" in the main page to display a FeedDialog and in a specific sequence the FeedDialog is empty with only the close button. I removed the navigation to the OptionsPage.

The sequence is :

  • Launch the application
  • Press the "Login To FB" button (enter your login/password)
  • Press the "FeedDialog FB" button (=>OK, I can see the FeedDialog with facebook interface)
  • Close the application (without log off)
  • Launch the application
  • Press the "Login To FB" button (no need to enter the login/password because the Access Token is valid)
  • Press the "FeedDialog FB" button (=>Problem, I can see only an empty Feeddialog with the close button).

The source code of the project is available here : http://1drv.ms/1LAK63w

The project solution is "Facebook - FeedDialog\samples\LoginCpp-UWP\LoginCpp-UWP.sln"
You need to configure the Resources.resw (FBApplicationId and FBWindowsAppId)
Can you reproduce the bug or why the FeedDialog is empty?

Regards,
AlanGusLive

=>OK
facebook - feeddialog success

=>Problem
facebook - feeddialog failed

Improperly formatted Doxygen comments

Some Doxygen comments are missing the extra character to alert the documentation generator that a comment is actually documentation. FBSession::ActiveSession is one that I've noticed, there may be more.

Can't login using LoginAsync on UWP app

I just started to use this SDK and I wanted to do a test app, but I can't login with Facebook. I get an exception from the FacebookDialog class. Here is my code:

 FBSession session = FBSession.ActiveSession;
 session.FBAppId = "<fb app secret>";
 session.WinAppId = "<app id>";

 var fbResult = await session.LoginAsync(new FBPermissions(new List<string> { "email" }));

Here is a screenshot with the exception: http://prntscr.com/871c6b

Cannot find FBReturnObject

Hi,
the documentation for using graph api requires a class called "FBReturnObject" but I could not find any reference to this class anywhere.
Documentation also says "A class will have to be created (FBReturnObject in this example) to receive and parse the json response."
But how do I create this class?

Can anyone help?

Need to add a method on FBSession to re-request permissions.

FB Login allows users to refuse permissions to apps on an individual basis. In the event that a permission is refused that the app must have to function, FB has a mechanism built into the oauth dialog that lets an app "re-request" the required permission. Not having this in the SDK will be a deal breaker for app authors.

Can't logout?

I don't have a clean repro on this, but I can't get a clean logout.

I call FBSession::ActiveSession::Logout(), I see it succeed, I verify in Windows Explorer that the file is gone, I restart the app, call FBSession::ActiveSession::LoginAsync(), and no WebView UI seems to appear but LoginAsync returns with valid FBuser data for the log'ed out user.

Is the xaml WebView cacheing data? I always try to make sure not to check the Facebook 'stay logged in' checkbox to prevent this sort of scenario.

For customers of apps, this is an odd scenario so low-pri.
For development, I need to login in as 2-3 different users to test all our apprequest scenarios. So this ends up as critical until I can figure out a workaround. My current workaround is to wait 2 hours for the access token to expire.

Add build script to build entire SDK

Blake: Currently there's no automated command-line build to build all of the SDK projects and samples and create the NuGet packages etc. one would expect to have in every build. We need a simple script that ties all the pieces together to automate everything.

Tracking as github issue

API too limited

I have a successful Windows 8.1 Store App that I am trying to update as a UWP app. My app is a photo booth which allows users to post their photo booth pictures on Facebook. They can post in three ways:

  1. Each user can post to his own personal page, requiring a FB login for each photo session.
  2. Users can post to the host's personal page (such as a bride or groom or birthday boy/girl). The host logs into the software once at the beginning.
  3. Users can post to a product or group page that is administered by the host. The host logs in at the beginning and selects to which of his pages he wants images to go.

Scenario 3 is extremely important as it is presently the most frequently used. However, I cannot see how this can be done with this new FB SDK.

With the old SDK, I could get a list of pages belonging to the user account by sending a "me/accounts" request which returned a JSON array of user-administered pages. I could then get a separate access token for each page. I could then create a FacebookClient object with the proper access token and all image posts would go to the selected product or group page.

How can this be accomplished with this new FB SDK?

Thank you and best regards,
Thaine Norris

Facebook Log Events

In Android and IOS FB SDK we have entire class for working with events logging:

public static void logEvent(String event) {
    try {
        Activity activity = mApplication.getActivity();
        AppEventsLogger logger = AppEventsLogger.newLogger(activity, mAppId);
        logger.logEvent(event);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

I think similar class and functionality will be useful for Windows SDK. Maybe you already planned this thing? If it useful for other users, I can try to do it by myself in my fork :)

Thanks

PM, not an issue: Did I fail to send 2 PRs to this repo?

I thought I sent a couple of pull requests to this repo. I believe my comment on my PRs was something along the lines of "Whenever I do something new with git I do it wrong, and this is my first PR." I suspect I did it wrong. I just added data classes and fields to the Generated classes to support our use of Facebook in our cross-platform game.

Commit messages:
Added profile picture to FBUser data-driven serialization
Added apprequest to data-driven serialization

I'd love to help make this a great SDK. I live in Seattle, worked ~5yrs @ MSFT, and happy to meet to chat.

Can't restore NuGet packages via command-line

We have a command-line build script which works, but only if the NuGet packages are in place. If someone clones the SDK repository, they will have to open the 8.1 and UWP SDK solutions in Visual Studio and restore the NuGet packages via the IDE before attempting a command-line build.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.