Do you know, How to create ACS cloud user account using Facebook login?
Yes, we can do using ACS Social Integrations.
The external account login will create a ACS Services account if it hasn't been created, otherwise, it will login using the user who has the matching external account info.
STEP 1 - Facebook login in Titanium App
Use below sample code for Facebook login
STEP 2 - Social Integration
After successfull login with Facebook, you will get Facebook accessToken, you can retrive this token using "Ti.Facebook.accessToken".
To integrate your facebook account with cloud, you need to pass three parameters to "Cloud.SocialIntegrations.externalAccountLogin" method,
id - External account's user id, optional for facebook. ACS server will obtain the uid using facebook token if id is missing
type - Type of the external account social media like Facebook, LinkedIn, Twitter(Currently only facebook token will be validated by the ACS server)
token - Token provided by the external account
add SocialIntegrations in Facebook login event listener
After the successful ACS Social Integrations go to
https://my.appcelerator.com/apps -> ypou-app -> Manage ACS -> Development -> Users
Here you will find a new cloud user account, which was created by external account login.
Other Methods
externalAccountLink - Associate an external account with an existing Appcelerator Cloud Services user account
externalAccountUnlink - Disassociate an external account from a Appcelerator Cloud Services user account.
searchFacebookFriends - Retrieves a list of Facebook Friends
References:
http://docs.appcelerator.com/titanium/2.1/index.html#!/api/Titanium.Cloud.SocialIntegrations
https://cloud.appcelerator.com/docs/api/v1/social/loginexternal
Yes, we can do using ACS Social Integrations.
The external account login will create a ACS Services account if it hasn't been created, otherwise, it will login using the user who has the matching external account info.
STEP 1 - Facebook login in Titanium App
Use below sample code for Facebook login
STEP 2 - Social Integration
After successfull login with Facebook, you will get Facebook accessToken, you can retrive this token using "Ti.Facebook.accessToken".
To integrate your facebook account with cloud, you need to pass three parameters to "Cloud.SocialIntegrations.externalAccountLogin" method,
id - External account's user id, optional for facebook. ACS server will obtain the uid using facebook token if id is missing
type - Type of the external account social media like Facebook, LinkedIn, Twitter(Currently only facebook token will be validated by the ACS server)
token - Token provided by the external account
add SocialIntegrations in Facebook login event listener
After the successful ACS Social Integrations go to
https://my.appcelerator.com/apps -> ypou-app -> Manage ACS -> Development -> Users
Here you will find a new cloud user account, which was created by external account login.
Other Methods
externalAccountLink - Associate an external account with an existing Appcelerator Cloud Services user account
externalAccountUnlink - Disassociate an external account from a Appcelerator Cloud Services user account.
searchFacebookFriends - Retrieves a list of Facebook Friends
References:
http://docs.appcelerator.com/titanium/2.1/index.html#!/api/Titanium.Cloud.SocialIntegrations
https://cloud.appcelerator.com/docs/api/v1/social/loginexternal
That was very helpful :)
ReplyDeleteAny idea how to publish to a Stream given I have the all the account info:id / type / token? Would that require me to make my own javascript call?
Hi Joe,
ReplyDeleteYou can use Ti.Facebook.requestWithGraphPath, for that you need to call Facebook Graph API call.
Refer this link for more info http://docs.appcelerator.com/titanium/2.1/index.html#!/api/Titanium.Facebook
Splendid! Thanks Again :)
ReplyDeleteHow can I change the URL of this application, so that I can login an account on a different webpage?
ReplyDeleteThe webpage I want to login is:
https://www.4life.com/login/default.aspx
Sorry, I can't understand. What do you mean "URL of this application"
ReplyDeleteI want to login to an account in this web page and I want to make an application to login to an account in this web page: www.4life.com/login/default.aspx. l want to use this code but I want to change the web address so that instead of logging into Facebook I could login to an account in the previous web page.
ReplyDeleteI want to use this code to login to a web page other than facebook, to be exact, I want to login to this web page: https://www.4life.com/login/default.aspx. That's what I mean by a different URL, its a different web page.
ReplyDeleteThanks in advance!
I don't think ACS social integration will support external site(https://www.4life.com/login/default.aspx).
ReplyDeleteAs per the documentation "external account social media like Facebook, LinkedIn, Twitter(Currently only facebook token will be validated by the ACS server)"
Is there a way it can detect if they are already logged in with FB and it can use their current information rather than asking for them to log in to FB again?
ReplyDeleteHi,
ReplyDeleteYou can check whether user logged in with FB using "Titanium.Facebook.loggedIn", it will retrieve boolean value
also, You can check whether cloud user logged in using "Cloud.hasStoredSession( )"
Thanks for a quick reply. I'll see if I can integrate this.
ReplyDeleteThanks, I used Cloud.hasStoredSession( ) to see if they've already registered. How do I populate the user fields in the ACS DB with their email, name, etc.?
ReplyDeleteHi,
ReplyDeletei.m trying to execute facebook login to my app.
Titanium.Facebook.appid you entered is our titanium appkey or else facebook app id..?
Hey when i use the code in step 1, it throws an error " Couldn`t find module "ti.cloud"
ReplyDeleteIt does check for facebook permission in web browser and when it returns to app the it throws this error
ReplyDelete