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

getProfile() function to use a variable for graphPath instead of a literal "me" #158

Open
chiemekailo opened this issue Sep 15, 2024 · 1 comment

Comments

@chiemekailo
Copy link

chiemekailo commented Sep 15, 2024

Is your feature request related to a problem? Please describe.
We all know that the Facebook graph request requires specific edges for particular permissions. The plugin has just the email permission in the getProfile() functions and hence hard-coded "me" for the graphPath. It would be more robust to have a variable.

Describe the solution you'd like
Use a variable such as below which allows for developers to insert any needed graph edge for permissions. One should be able to search the me or the me/friends edge, for example.

Describe alternatives you've considered
In Plugin.swift change:
let graphRequest = GraphRequest.init(graphPath: "me", parameters: parameters)
into
let graphRequest = GraphRequest.init(graphPath: gPath, parameters: parameters).

That will allow the javascript function to be

const profile = await FacebookLogin.getProfile<{
          email: string; || user_friends: string;
        }>({ fields: ["email"] || ["user_friends"], graphPath: "me" || "me/friends" })

Additional context
I added one/two lines of code each in 5 files in the project to achieve this:

Plugin.swift
FacebookLogin.java
web.js
web.d.ts
definitions.d.ts
@sinanverve7
Copy link

sinanverve7 commented Dec 31, 2024

would be nice if it have

.api

method like cordova-facebook-connect, no need to manage graph api version ourself,when the graph api version expires

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

2 participants