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

Could not convert string to integer: public_profile. Path 'data[0].permission' #293

Closed
SamuelEshetu opened this issue May 2, 2014 · 35 comments

Comments

@SamuelEshetu
Copy link

This Issue comes after update in the facebook api from 30th April 2014 they have removed some of default permissions and rename the "basic_info" to "public_profile"

can you please look in to this and do as need full.

this issue is only occurs when we create new facebook app and then run it.

the old facebook app works fine.

Could not convert string to integer: public_profile. Path 'data[0].permission', line 1, position 39.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Newtonsoft.Json.JsonReaderException: Could not convert string to integer: public_profile. Path 'data[0].permission', line 1, position 39.

@ntotten
Copy link
Contributor

ntotten commented May 3, 2014

What Facebook app are you using? This seems to be an issue with whatever object you are trying to serialize to, not an issue with the SDK itself.

@prabirshrestha
Copy link
Member

@rvparekh which version of the sdk are you using. we don't use data[0].permission in v6.

@SamuelEshetu
Copy link
Author

I am using the facebook version 6.0.10.0 which comes with asp.net mvc facebook app template.
this error comes after the update in the facebook api they have change default permission basic_info with public_profile. and also done some more changes in their api's

@SamuelEshetu
Copy link
Author

I have created app for facebook and page tab app for the application.

@SamuelEshetu
Copy link
Author

this error comes with the new app created in the developers.facebook.com.
app created after 30th April 2014

@sanjeevdwivedi
Copy link
Contributor

Looking. At F8, Facebook did make announcements that they are changing the way the login dialogs work i.e. more granular permissions check. This impacts new apps only, so we will have to validate with a new app.

@franciellecastilhos1
Copy link

We are getting the same error. Anyone knows how to help?

@sanjeevdwivedi
Copy link
Contributor

@franciellecastilhos1 Is this happening during Login or during a different Open Graph request? What platform are you using it for?

@mcorrearodrigues
Copy link

I have same error.
I believe that the error is in [FacebookAuthorize()] attribute method.
If just [FacebookAuthorize()] , ok worked. But, if i put [FacebookAuthorize("email", "...")] show me the error.
[JsonReaderException: Could not convert string to integer: public_profile. Path 'data[0].permission', line 1, position 39.]

@franciellecastilhos1
Copy link

@sanjeevdwivedi this happens when authorizing the app to get user's data, the window to ask for the permissions doesn't open, the error happens when it tries accessing the method FacebookAuthorize("email", "...")] as @mcorrearodrigues said. If we change to FacebookAuthorize() it works, but then I won't be able to set the user's permissions that I need.
We are running a default web app for FB.

@franciellecastilhos1
Copy link

Hi everyone,

I think this is an important info:

"We will review how apps use Facebook Login: Apps requesting more than public_profile, email and the user_friends permission must be reviewed by Facebook before those permissions can be requested from people. Existing apps have one year before they are required to go through login review, including updates to existing apps. Facebook apps created after April 30th, 2014 will have to go through review."

Source: https://developers.facebook.com/docs/apps/changelog

@sanjeevdwivedi
Copy link
Contributor

Looking.

@sanjeevdwivedi
Copy link
Contributor

I tried this with the Facebook SDK version 6.4.2, the last version released about 6 months back and everything seems to be working fine.

@rvparekh We cannot support the 6.0.x version as that is almost 2 years old and a lot of things have changed.

@franciellecastilhos1 The FacebookAuthorize attribute is not present in the latest version, so I am assuming that you are using a previous version of the SDK. Please upgrade to the latest version and reopen the bug if you still the same issue.

Closing this bug since this is based off a really old version of the SDK.

@mcorrearodrigues
Copy link

Hi, @sanjeevdwivedi

Can you send for us your solution ?
I did a test on a new VS 2013 project using the version mentioned and still the error persists.

[code]
[FacebookAuthorize("email", "user_photos")]
public async Task Index(FacebookContext context)
{
if (ModelState.IsValid)
{
var user = await context.Client.GetCurrentUserAsync();
return View(user);
}

        return View("Error");
    }

[/code]

@sanjeevdwivedi
Copy link
Contributor

@mcorrearodrigues Can you upload a sample project that I can open in Visual Studio directly. Remove your AppID and AppSecret and I will look at what is going on.

@sanjeevdwivedi sanjeevdwivedi reopened this May 9, 2014
@sanjeevdwivedi
Copy link
Contributor

@rvparekh @franciellecastilhos1 If either of you can upload a sample project somewhere that will be helpful. I did not realize that Microsoft.AspNet.Mvc.Facebook has taken a dependency on the project and the code is breaking via that path.

@mcorrearodrigues
Copy link

Thanks @sanjeevdwivedi
Look my repository https://github.com/mcorrearodrigues/WebApplicationFacebook
It´s a default facebook web application in Visual Studio 2013.

@sanjeevdwivedi
Copy link
Contributor

Thanks. Looking.

@sanjeevdwivedi
Copy link
Contributor

What are the settings you are using in the configuration. As of now, when running the website locally, I keep getting configuration errors. How is the following filled out for you?
image

@mcorrearodrigues
Copy link

Thanks @sanjeevdwivedi

My Settings is:

1 - Add Platform - Choose App on Facebook
2 - URL and Secure Canvas URL - input https://localhost:44301/

@SamuelEshetu
Copy link
Author

Hello @sanjeevdwivedi

My settings are:
1 - Add Platform - Choose App on Facebook
2 - Add Platform - Choose Page Tab
3 - URL and Secure Canvas URL

2014-05-10_1053

I have used default asp.mvc facebook application template for creating facebook app.

Repo url:https://github.com/rvparekh/fbdemo

@ieatanu
Copy link

ieatanu commented May 10, 2014

Hi @sanjeevdwivedi,

I am also facing the same issue. It's happening with pretty basic setup. Here are the reproduction steps:

  1. Create an NEW app on facebook as "App on facebook".
  2. Create a new facebook application project on VS 2013 (.NET 4.5)
  3. Set your App ID, App Secret & App namespace in Web.config.
  4. Click on your project in solution explorer & Press F4.
  5. Set SSL Enabled property to "True".
  6. Copy URL & SSL URL from there.
  7. Set your canvas URL & secure canvas URL as per your URL & SSL URL accordingly (http://localhost:8770/ & https://localhost:44301/).
  8. Goto Menu in VS 2013, then Project -> Properties -> Web
  9. Under server section, set project URL to your SSL URL and then click on "create virtual directory" button.
  10. Save all & hit F5.

Now, once you have granted the basic permission on facebook.com, we can see the following error message from newtonsoft json assembly.

Exception Details: Newtonsoft.Json.JsonReaderException: Could not convert string to integer: public_profile. Path 'data[0].permission', line 1, position 39.

I have also found two partial solution to the issue:

  1. If you are using any old app (created before 30th April) from your facebook dev accout, everything will work fine.
  2. Change the line no 13 in HomeController from:
    [FacebookAuthorize("email", "user_photos")]
    to
    [FacebookAuthorize]
    now, you will not get the error message any more. But in this case we will not be able to use those functionality.

screen

@ntotten
Copy link
Contributor

ntotten commented May 11, 2014

This issue is actually coming from the ASP.NET template. We should file a
bug at http://aspnetwebstack.codeplex.com/workitem/list/basic to get the
ASP.NET Facebook Template fixed.

On Sat, May 10, 2014 at 10:23 AM, ieatanu notifications@github.com wrote:

Hi @sanjeevdwivedi https://github.com/sanjeevdwivedi,

I am also facing the same issue. It's happening with pretty basic setup.
Here are the reproduction steps:

  1. Create an NEW app on facebook as "App on facebook".
  2. Create a new facebook application project on VS 2013 (.NET 4.5)
  3. Set your App ID, App Secret & App namespace in Web.config.
  4. Click on your project in solution explorer & Press F4.
  5. Set SSL Enabled property to "True".
  6. Copy URL & SSL URL from there.
  7. Set your canvas URL & secure canvas URL as per your URL & SSL URL
    accordingly (http://localhost:8770/ & https://localhost:44301/).
  8. Goto Menu in VS 2013, then Project -> Properties -> Web
  9. Under server section, set project URL to your SSL URL and then
    click on "create virtual directory" button.
  10. Save all & hit F5.

Now, once you have granted the basic permission on facebook.com, we can
see the following error message from newtonsoft json assembly.

Exception Details: Newtonsoft.Json.JsonReaderException: Could not convert
string to integer: public_profile. Path 'data[0].permission', line 1,
position 39.

I have also found two partial solution to the issue:

If you are using any old app (created before 30th April) from your
facebook dev accout, everything will work fine.
2.

Change the line no 13 in HomeController from:

[FacebookAuthorize("email", "user_photos")]
to
[FacebookAuthorize]
now, you will not get the error message any more. But in this case we
will not be able to use those functionality.

[image: screen]https://cloud.githubusercontent.com/assets/7159032/2936624/987d4b24-d867-11e3-842a-4fe6756288fa.png


Reply to this email directly or view it on GitHubhttps://github.com//issues/293#issuecomment-42748313
.

@ntotten ntotten closed this as completed May 11, 2014
@vishalmandloi
Copy link

Then how we take permissions from users ?

@drinkbird
Copy link

Use the new Microsoft.AspNet.Facebook package

@abdullahaslan
Copy link

@drinkbird I installed latest version of Facebook SDK(6.6.0) and Microsoft.Aspnet.Mvc.Facebook (5.1.2) . Bu sttil getting same error. Did anyone find a solution for this. I am using VS 2012

@drinkbird
Copy link

@abdullahaslan Do not use the 'Microsoft.AspNet.Mvc.Facebook' library. It has been discontinued! Use the new 'Microsoft.AspNet.Facebook' package (Without the .mvc. part in the name).

@abdullahaslan
Copy link

Thanks @drinkbird . Downloaded new one via "Install-Package Microsoft.AspNet.Facebook" (1.0.0)
This time I cant get current user information. With old one we can do.
"await context.Client.GetCurrentUserAsync();"
I could not find any method for this. Can you share dll or say where can I find documentation.
.

@drinkbird
Copy link

@abdullahaslan You can find the official code from microsoft at
https://aspnetwebstack.codeplex.com/SourceControl/latest#src/Microsoft.AspNet.Facebook/
Unfortunately there is no documentation yet. I was able to use the exact
same commands from the old sdk just by altering the referenced namespace,
so there is something else going on with your project. Maybe your user
class has some error.

2014-07-11 9:31 GMT+03:00 abdullahaslan notifications@github.com:

Thanks @drinkbird https://github.com/drinkbird . Downloaded new one via
"Install-Package Microsoft.AspNet.Facebook" (1.0.0)
This time I cant get current user information. With old one we can do.
"await context.Client.GetCurrentUserAsync();"
I could not find any method for this. Can you share dll or say where can I
find documentation.
.


Reply to this email directly or view it on GitHub
#293 (comment)
.

Anastasios Piotopoulos
Software Engineer, Computer Science, BSc

LinkedIn: https://www.linkedin.com/in/piotopoulos
Twitter: http://twitter.com/piotopoulos
Facebook: http://facebook.com/piotopoulos

@abdullahaslan
Copy link

The problem is solved. Thanks @drinkbird
On VS2013 First run "nuget Microsoft.AspNet.mvc" then "nuget Microsoft.AspNet.Facebook"
It is ok now.

@isaacrael
Copy link

Yep, I second that .... thanks @drinkbird I was able to get my Facebook app working!

@abdullahaslan
Copy link

@drinkbird and @isaacrael Now trying to get user friend list but always return empty. Application can get user photos, email ,name. Is there anything missing.
This app needs:
Your public profile
Your friend list
Your email address (xxxxxxx)
Your photos

Permission :
[FacebookAuthorize("email", "public_profile","user_friends")]
public async Task Index(FacebookContext context)
{
//Code
var user = await context.Client.GetCurrentUserAsync();
//user.Friends null
var userfriends = await context.Client.GetCurrentUserFriendsAsync();
//userFriends also null
}
Thanks

@drinkbird
Copy link

@abdullahaslan since graph api v2, the system return only the friends that
actually use the application. To be able to invite friends to use the
application, you should use the invitable friends api
*https://developers.facebook.com/docs/games/invitable-friends
https://developers.facebook.com/docs/games/invitable-friends *

2014-07-14 9:59 GMT+03:00 abdullahaslan notifications@github.com:

@drinkbird https://github.com/drinkbird Now trying to get user friend
list but always return empty. Application can get user photos, email ,name.
Is there anything missing.
This app needs:

Your public profile
Your friend list
Your email address (xxxxxxx)
Your photos

Permission :
[FacebookAuthorize("email", "public_profile","user_friends")]
public async Task Index(FacebookContext context)
{
//Code
var user = await context.Client.GetCurrentUserAsync();
//user.Friends null
var userfriends = await context.Client.GetCurrentUserFriendsAsync();
//userFriends also null
}
Thanks


Reply to this email directly or view it on GitHub
#293 (comment)
.

Anastasios Piotopoulos
Software Engineer, Computer Science, BSc

LinkedIn: https://www.linkedin.com/in/piotopoulos
Twitter: http://twitter.com/piotopoulos
Facebook: http://facebook.com/piotopoulos

@minagy
Copy link

minagy commented Jul 25, 2014

@ieatanu you are terrific

@gdyrrahitis
Copy link

@drinkbird Thank you!!

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