Enableing Facebook Users to Make posts









up vote
0
down vote

favorite












I was able to set up my app so that a user can register with an email and password and was able to make a post but when I integrated the facebook login, I was not able to make any posts (writing to Firebase), I looked into permissions that might be necessary for those users but wasnt able to find anything. The following is my code for my posting to firebase



 @IBAction func handlePostButton(_ sender: Any) 

guard let userProfile = UserService.currentUserProfile else return


//Firebase code
//Lets make a reference to the database
let postref = Database.database().reference().child("posts").childByAutoId() //This will assign this post a specific identifier that we can reference it by.
//This is referencing the place where you write a post
let postObject = [
"author":[
"uid": userProfile.uid,
"photoURL": userProfile.photoURL.absoluteString,
"username": userProfile.username
],
"text": textView.text,
"timestamp": [".sv": "timestamp"] //This is actually getting the time from Firebase, this is a server value.
] as [String:Any]
postref.setValue(postObject, withCompletionBlock: Error, ref in
if Error == nil
self.dismiss(animated: true, completion: nil)
else

self.creatAlert(title: "Error", message: "Error making a Post!")

)




not sure what else I should put up.










share|improve this question























  • make a post where exactly? on facebook? in your app?
    – luschn
    Nov 10 at 8:58










  • @luschn make a post in my app, but the actual question is just writing to the firebase
    – user443902
    Nov 10 at 14:34










  • ok, but right now all we know is "it does not work", you need to be more specific. did you debug it?
    – luschn
    Nov 11 at 14:21










  • @luschn I tried but couldn’t get any resolution, I already have my rules set for auth users to write and read posts, I’m not sure if my Facebook user is considered “authenticated”
    – user443902
    Nov 11 at 14:22










  • Could you confirm that Facebook is enabled (and you provided AppID and App Secret) in the "sign-in method" configuration for Authentication in Firebase?
    – Peter Pajchl
    Nov 13 at 17:28














up vote
0
down vote

favorite












I was able to set up my app so that a user can register with an email and password and was able to make a post but when I integrated the facebook login, I was not able to make any posts (writing to Firebase), I looked into permissions that might be necessary for those users but wasnt able to find anything. The following is my code for my posting to firebase



 @IBAction func handlePostButton(_ sender: Any) 

guard let userProfile = UserService.currentUserProfile else return


//Firebase code
//Lets make a reference to the database
let postref = Database.database().reference().child("posts").childByAutoId() //This will assign this post a specific identifier that we can reference it by.
//This is referencing the place where you write a post
let postObject = [
"author":[
"uid": userProfile.uid,
"photoURL": userProfile.photoURL.absoluteString,
"username": userProfile.username
],
"text": textView.text,
"timestamp": [".sv": "timestamp"] //This is actually getting the time from Firebase, this is a server value.
] as [String:Any]
postref.setValue(postObject, withCompletionBlock: Error, ref in
if Error == nil
self.dismiss(animated: true, completion: nil)
else

self.creatAlert(title: "Error", message: "Error making a Post!")

)




not sure what else I should put up.










share|improve this question























  • make a post where exactly? on facebook? in your app?
    – luschn
    Nov 10 at 8:58










  • @luschn make a post in my app, but the actual question is just writing to the firebase
    – user443902
    Nov 10 at 14:34










  • ok, but right now all we know is "it does not work", you need to be more specific. did you debug it?
    – luschn
    Nov 11 at 14:21










  • @luschn I tried but couldn’t get any resolution, I already have my rules set for auth users to write and read posts, I’m not sure if my Facebook user is considered “authenticated”
    – user443902
    Nov 11 at 14:22










  • Could you confirm that Facebook is enabled (and you provided AppID and App Secret) in the "sign-in method" configuration for Authentication in Firebase?
    – Peter Pajchl
    Nov 13 at 17:28












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I was able to set up my app so that a user can register with an email and password and was able to make a post but when I integrated the facebook login, I was not able to make any posts (writing to Firebase), I looked into permissions that might be necessary for those users but wasnt able to find anything. The following is my code for my posting to firebase



 @IBAction func handlePostButton(_ sender: Any) 

guard let userProfile = UserService.currentUserProfile else return


//Firebase code
//Lets make a reference to the database
let postref = Database.database().reference().child("posts").childByAutoId() //This will assign this post a specific identifier that we can reference it by.
//This is referencing the place where you write a post
let postObject = [
"author":[
"uid": userProfile.uid,
"photoURL": userProfile.photoURL.absoluteString,
"username": userProfile.username
],
"text": textView.text,
"timestamp": [".sv": "timestamp"] //This is actually getting the time from Firebase, this is a server value.
] as [String:Any]
postref.setValue(postObject, withCompletionBlock: Error, ref in
if Error == nil
self.dismiss(animated: true, completion: nil)
else

self.creatAlert(title: "Error", message: "Error making a Post!")

)




not sure what else I should put up.










share|improve this question















I was able to set up my app so that a user can register with an email and password and was able to make a post but when I integrated the facebook login, I was not able to make any posts (writing to Firebase), I looked into permissions that might be necessary for those users but wasnt able to find anything. The following is my code for my posting to firebase



 @IBAction func handlePostButton(_ sender: Any) 

guard let userProfile = UserService.currentUserProfile else return


//Firebase code
//Lets make a reference to the database
let postref = Database.database().reference().child("posts").childByAutoId() //This will assign this post a specific identifier that we can reference it by.
//This is referencing the place where you write a post
let postObject = [
"author":[
"uid": userProfile.uid,
"photoURL": userProfile.photoURL.absoluteString,
"username": userProfile.username
],
"text": textView.text,
"timestamp": [".sv": "timestamp"] //This is actually getting the time from Firebase, this is a server value.
] as [String:Any]
postref.setValue(postObject, withCompletionBlock: Error, ref in
if Error == nil
self.dismiss(animated: true, completion: nil)
else

self.creatAlert(title: "Error", message: "Error making a Post!")

)




not sure what else I should put up.







ios swift firebase-realtime-database firebase-authentication facebook-login






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 10 at 0:43









Frank van Puffelen

221k25362387




221k25362387










asked Nov 9 at 23:53









user443902

105




105











  • make a post where exactly? on facebook? in your app?
    – luschn
    Nov 10 at 8:58










  • @luschn make a post in my app, but the actual question is just writing to the firebase
    – user443902
    Nov 10 at 14:34










  • ok, but right now all we know is "it does not work", you need to be more specific. did you debug it?
    – luschn
    Nov 11 at 14:21










  • @luschn I tried but couldn’t get any resolution, I already have my rules set for auth users to write and read posts, I’m not sure if my Facebook user is considered “authenticated”
    – user443902
    Nov 11 at 14:22










  • Could you confirm that Facebook is enabled (and you provided AppID and App Secret) in the "sign-in method" configuration for Authentication in Firebase?
    – Peter Pajchl
    Nov 13 at 17:28
















  • make a post where exactly? on facebook? in your app?
    – luschn
    Nov 10 at 8:58










  • @luschn make a post in my app, but the actual question is just writing to the firebase
    – user443902
    Nov 10 at 14:34










  • ok, but right now all we know is "it does not work", you need to be more specific. did you debug it?
    – luschn
    Nov 11 at 14:21










  • @luschn I tried but couldn’t get any resolution, I already have my rules set for auth users to write and read posts, I’m not sure if my Facebook user is considered “authenticated”
    – user443902
    Nov 11 at 14:22










  • Could you confirm that Facebook is enabled (and you provided AppID and App Secret) in the "sign-in method" configuration for Authentication in Firebase?
    – Peter Pajchl
    Nov 13 at 17:28















make a post where exactly? on facebook? in your app?
– luschn
Nov 10 at 8:58




make a post where exactly? on facebook? in your app?
– luschn
Nov 10 at 8:58












@luschn make a post in my app, but the actual question is just writing to the firebase
– user443902
Nov 10 at 14:34




@luschn make a post in my app, but the actual question is just writing to the firebase
– user443902
Nov 10 at 14:34












ok, but right now all we know is "it does not work", you need to be more specific. did you debug it?
– luschn
Nov 11 at 14:21




ok, but right now all we know is "it does not work", you need to be more specific. did you debug it?
– luschn
Nov 11 at 14:21












@luschn I tried but couldn’t get any resolution, I already have my rules set for auth users to write and read posts, I’m not sure if my Facebook user is considered “authenticated”
– user443902
Nov 11 at 14:22




@luschn I tried but couldn’t get any resolution, I already have my rules set for auth users to write and read posts, I’m not sure if my Facebook user is considered “authenticated”
– user443902
Nov 11 at 14:22












Could you confirm that Facebook is enabled (and you provided AppID and App Secret) in the "sign-in method" configuration for Authentication in Firebase?
– Peter Pajchl
Nov 13 at 17:28




Could you confirm that Facebook is enabled (and you provided AppID and App Secret) in the "sign-in method" configuration for Authentication in Firebase?
– Peter Pajchl
Nov 13 at 17:28

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53234735%2fenableing-facebook-users-to-make-posts%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53234735%2fenableing-facebook-users-to-make-posts%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Use pre created SQLite database for Android project in kotlin

Darth Vader #20

Ondo