Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Talk:Facebook authentication in Windows Phone application

From Wiki
Jump to: navigation, search

Contents

Tapanila - Why you aren't using FacebookCsharpSDK?

There exists a very good Facebook C# SDK that works perfectly for Windows Phone. https://github.com/facebook-csharp-sdk/facebook-csharp-sdk

Why you aren't using it?

It's way easier to use.

Tapanila 13:09, 14 August 2012 (EEST)

Hamishwillee - This article states "without using any third party library."

Hi Tapanila

Thanks for pointing this out. Obviously its a good idea to use a well maintained third party library provided cost and licencing permit. Perhaps the author didn't know about this library, or wanted to remove a dependency on any third party library, or perhaps they thought that showing how it is done would be useful for some users.

In any case, the article states that it is for use if you don't want to use a third party library, and is therefore accurate.

That said I have added a note near the top suggesting this library. Is this a "defacto standard" - or are there other competitive C# libraries you know about?

Regards

Hamish

hamishwillee 06:44, 15 August 2012 (EEST)

Spaced Sweden - I would do as the author if its only authentication you are after

But there is a problem with this solution, you will be shipping your api key and secret wich is really easy to sniff, and that is a secuirty flaw

what you should do is to add &response_type=token to "https://www.facebook.com/dialog/oauth?client_id=<Your Key>&redirect_uri=https://www.facebook.com/connect/login_success.html&scope=email,user_location,friends_location,user_hometown,friends_hometown,publish_stream,offline_access,read_stream,user_status,user_photos,friends_photos,friends_status,user_checkins,friends_checkins,user_events,publish_checkins&display=touch

By adding response_type you never have to send you secret from a phone and you are saving one request wich is nice.

Worth noting is that WAP is not a valid display type any more.

Regarding 3rd party libs, i would just stick with my own if its only user auth you are after.

Have fun

spaced_Sweden 10:19, 16 August 2012 (EEST)

Somnathbanik - Hi friends

Hi Friends,

@Tapanila : I would like to echo what Hamish said. I knew about the Facebook C# SDK, and have tried that, also got few examples on web using that SDK. Cause of that I thought of writing an article that authenticates without using any third party library.


@spaced_Sweden  : First of all welcome to Nokia Developer Community.

This is a technique alternative of the available 3rd party library. Regarding permission and display you can always go to facebook developer web site for more updated information, like offline_access doesn't support now, but has no harm here, same with display also :)

somnathbanik 13:32, 16 August 2012 (EEST)

Sarahpy - I cannot get the profile picture to show up after logged in

after try your code

i can login successfully

and the username is show up

but the profile picture didn't show

could you help me and explain more about how i get the profile picture in you ResponseCallbackProfile

sarahpy 07:26, 19 February 2013 (EET)

Somnathbanik - Facebook API changed

Hi Sarahpy,

The Facebook API has updated and is getting some extra text in the Access Token after "&". Please open the function ResponseCallback_AccessToken from the code and Split the access token. Here is the code that I created for you.

 string[] splitAccessToken = responseString.Split(new Char[] { '=','&' });
                           string accessTokenString = splitAccessToken.GetValue(0).ToString();
                           string accessTokenValue = splitAccessToken.GetValue(1).ToString();
string accessTokenTemp = splitAccessToken.GetValue(2).ToString();

somnathbanik 07:58, 19 February 2013 (EET)

Somnathbanik - @Sarahpy - Continue

string[] splitAccessToken = responseString.Split(new Char[] { '=','&' });
string accessTokenString = splitAccessToken.GetValue(0).ToString();
string accessTokenValue = splitAccessToken.GetValue(1).ToString();
string accessTokenTemp = splitAccessToken.GetValue(2).ToString();

somnathbanik 08:01, 19 February 2013 (EET)

Koimliddinilah -

hiiiii my probleme is same Sarahpy...

code string[] splitAccessToken = responseString.Split(new Char[] { '=','&' }); string accessTokenString = splitAccessToken.GetValue(0).ToString(); string accessTokenValue = splitAccessToken.GetValue(1).ToString();

string accessTokenTemp = splitAccessToken.GetValue(2).ToString();


is not work? any our code to show picture??

Koimliddinilah 13:48, 23 February 2013 (EET)

Somnathbanik - New version of source code

Hi,

Based on the change on Facebook API I have also added a updated version of the source code. Before you try the sample code make sure to add the Key and Secret.

somnathbanik 16:47, 23 February 2013 (EET)

Somnathbanik - Compatibility

This article is Compatible for both Windows Phone 7 and Windows Phone 8.

We will update the title accordingly.

somnathbanik 12:55, 5 June 2013 (EEST)

Shashankholla - Shashankholla - Beginner Error.

I am getting this error An exception of type 'System.IndexOutOfRangeException' occurred in mscorlib.ni.dll but was not handled in user code

If there is a handler for this exception, the program may be safely continued.

And the emulator shows Success and Security Warning. But I am not returning to MainPage.xaml to show the User Profile Picture and Name.

shashankholla (talk) 13:30, 23 March 2014 (EET)

 

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×