shomniauth / shomniauthfacebook Goto Github PK
View Code? Open in Web Editor NEWFacebook Strategy for SHOmniAuth, uses ACAccount and the Facebook SDK
License: MIT License
Facebook Strategy for SHOmniAuth, uses ACAccount and the Facebook SDK
License: MIT License
Hej again,
I'm trying to use SHOmniAuthFacebook in the same way as I used SHOmniAuthTwitter.
So, the code below is the same as I used for Twitter (in twitter the first word is SHOmniAuthTwitter)
[SHOmniAuthFacebook performLoginWithListOfAccounts:^(NSArray *accounts, SHOmniAuthAccountPickerHandler pickAccountBlock) {
UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:@"Pick account"];
[accounts each:^(id<account> account) {
[actionSheet addButtonWithTitle:account.username handler:^{
pickAccountBlock(account);
}];
}];
NSString * buttonTitle = nil;
if(accounts.count > 0)
buttonTitle = @"Add account";
else
buttonTitle = @"Connect";
[actionSheet addButtonWithTitle:buttonTitle handler:^{
pickAccountBlock(nil);
}];
[actionSheet addButtonWithTitle:@"Cancel" handler:^{
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
[actionSheet showInView:self.view];
} onComplete:^(id<account> account, id response, NSError *error, BOOL isSuccess) {
// etc
What I'm finding is that, in Twitter, when I click Add Account in the Action Sheet (the actionsheet shows cannyboy.twitter, Add Account, Cancel), it does what I expect, and goes to Safari to log in to an account.
However, when I click Add Account using SHOmniAuthFacebook, it logs in using the existing FB credentials (in Settings app)
Is this the expected behaviour? Should I not display Add Account for FB?
SHOmniAuthFacebook seems to default to asking for the email only (from Facebook). Is there a way to ask for the birthday too?
I've managed to get it working by changing the library, in SHOmniAuthFacebook.m
, +(void)performLoginForNewAccount:(SHOmniAuthAccountResponseHandler)completionBlock;
to:
[FBSession openActiveSessionWithReadPermissions:@[@"email", @"user_birthday"]
.. but is there a better way to do this, without altering the library?
Are you suppose to use registerProvidersWith
...?
[SHOmniAuth registerProvidersWith:^(SHOmniAuthProviderBlock provider) {
provider(SHOmniAuthFacebook.provider, kFacebookAppID,kFfacebookAppSecret, @"email,user_birthday", @"shopcade://fbsuccess");
... I'm not sure @"email,user_birthday" gets passed to the right place?
I think for Twitter it is necessary, but can I leave it out when using SHOmniAuth for Facebook? Like:
[SHOmniAuth registerProvidersWith:^(SHOmniAuthProviderBlock provider) {
provider(SHOmniAuthFacebook.provider, facebookAppID, @"", @"email", @"myApp://fbsuccess");
}];
I've had an issue since January 17... Coincidently, the date of the 3.11.1 Facebook SDK release. https://developers.facebook.com/docs/ios/change-log-3.x/
performLoginWithListOfAccounts
is returning a response of null and and isSuccess of 0. Before it worked fine.
Strangely, I went into my Facebook app permissions, and removed my apps permission to Post on my wall (this was granted via the web version of my app). Then I was able to login with Facebook on my iOS app.
Forgive me if this is a stupid question...
Does SHOmniAuthFacebook retain some kind of session when a user logs in?
I'd like to be able to invite FB friends to my app. I think the best way of doing this is something like this:
[FBWebDialogs presentRequestsDialogModallyWithSession:nil
message:@“Check out my app."
title:@"Invite Friends"
parameters:nil
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
}
];
..but this asks the user to login again. Is their a way to use the existing SHOmniAuthFacebook session to login, so that the user doesn't have to login again?
On line 151 in SHOmniAuthFacebook.m
authHash[@"token"] = account.credential.oauthToken;
.. I get this error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: token)'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.