Table of contents
- 1. Field Summary
- 2. Method Summary
- 3. Method Detail
- 3.1. initWithAPIKey
- 3.1.1. Parameters:
- 3.2. showLoginUI
- 3.2.1. Parameters:
- 3.3. showAddConnectionsUI
- 3.3.1. Parameters:
- 3.4. sendRequest
- 3.4.1. Parameters:
- 3.5. sendRequest (with HTTPS)
- 3.5.1. Parameters:
- 3.6. login
- 3.6.1. Parameters:
- 3.7. logout
- 3.8. addConnection
- 3.8.1. Parameters:
- 3.9. removeConnection
- 3.9.1. Parameters:
- 3.10. getSession
- 3.11. setSession
- 3.11.1. Parameters:
- 3.12. setAPIDomain
- 3.12.1. Parameters:
- 3.13. requestFacebookPublishPermission
- 3.13.1. Parameters:
- 3.1. initWithAPIKey
The central class of the Gigya iOS SDK. Instances of the GSAPI class provide access to the Gigya service.
Field Summary
| Field | Type | Description |
| eventDelegate | GSEventDelegate | This delegate may be used to receive notification about the following global events: Login, Logout, Connection Added, Connection Removed. |
Method Summary
| Method | Description |
| initWithAPIKey | Initialization method. |
| showLoginUI | Displays a "Login" UI for selecting a social network to login to. |
| showAddConnectionsUI | Displays the Add Connections UI, with a selection of providers icons for adding connections. |
| sendRequest | Send any request supported by our REST API. |
| sendRequest (with HTTPS) | Send any request supported by our REST API. Supports HTTPS override. |
| login | Login the user to a specified provider. |
| logout | This method Logs out the current user of Gigya Platform. |
| addConnection | Add a Social Network connection to a specified provider for the current user. (The provider is specified via params). |
| removeConnection | Removes an existing Social Network connection from the current user. (The provider is specified via params). |
| getSession | Get the current session. Returns nil if session doesn't exist. |
| setSession | Sets a new session. The method saves the session in app's storage. |
| setAPIDomain | Sets the domain used for making API calls. Enables to determine usage of a specific data center. |
| requestFacebookPublishPermission | Initiates requesting Facebook publish permissions from the user. |
Method Detail
initWithAPIKey
(id) initWithAPIKey:(NSString*)apiKey
Initialization method.
Parameters:
- APIKey - your Gigya API Key, which can be obtained on the Site Dashboard page on Gigya's website. See also the Gigya's Setup documentation.
showLoginUI
(void) showLoginUI:(GSObject*)params ViewController:(UIViewController *)MainViewController delegate:(id<GSLoginUIDelegate>)delegate context:(void*):context
Displays a "Login" UI for selecting a social network to login to. The UI includes all the available providers' logos as login options, enabling the user to login via his social network / webmail account.
Parameters:
- params: may include the following fields:
- enabledProviders (optional) - a comma delimited list of providers that should be displayed on the UI. The list also defines the order in which the icons will be presented. Valid provider names include: facebook, twitter, yahoo, messenger, google, googleplus, linkedin, myspace, aol, foursquare, orkut, renren, qq, sina, kaixin, vkontakte, blogger, wordpress, typepad, paypal, livejournal, hyves, verisign, openid, netlog, signon, orangefrance, mixi, yahoojapan, spiceworks, livedoor, skyrock, vznet.
- disabledProviders (optional) - a comma delimited list of provider that should not be displayed on the UI.
- captionText (optional) - sets the caption text.
- cid (optional) - a string of maximum 100 characters length. This string will be associated with each transaction and will later appear on reports generated by Gigya, in the "Context ID" combo box. The cid allows you to associate the report information with your own internal data. The "Context ID" combo box lets you filter the report data by application context.
- facebookReadPermissions (optional) - a comma delimited list of Facebook read permissions to request from the user. This parameter gives the possibility to request extended read permissions in addition to the permissions that Gigya is already requesting.
Please refer to Facebook's permissions documentation, for the complete list of read permissions. The default value of this parameter is "email". Note: you should only include read permissions, otherwise Facebook will fail the login.
Note: use the socialize.getRawData method to pull the extra data. - googleExtraPermissions (optional) - this parameter gives the possibility to request extended permissions in addition to the permissions that Gigya is already requesting. The supported values are: "wallet" - for Google wallet permissions.
- forceAuthentication (optional) - the default value of this parameter is 'false'. If set to 'true', the user will be forced to provide her social network credentials during the login, even if she is already connected to the social network. Please note, that the behavior of the various social networks may be slightly different. For example, Facebook expects the current user to enter his password, and would not accept a different user name.
- pendingRegistration (optional) - The default value of this parameter is 'true'. The default behavior - the account is not considered final until socialize.notifyRegistration is called. While being not-final the identities associated with this account can be connected to another account without causing an error. If this parameter is set to 'false' - when a new user logs-in (registers), his new Gigya account is final immediately.
- facebookSSOFallback (optional) - The parameter accepts two possible values: "webview" (default) or "safari". The parameter determines whether Gigya will open a webview or a Safari instance when trying to do SSO (Single Sign-On) while Facebook application is not installed.
- facebookAppId (optional) - The facebook app ID. This parameter is required if you implement facebook SSO. Learn more in Adding Facebook Single Sign-on.
- facebookLocalAppId (optional) - Set a local facebook app ID, if you have multiple facebook apps using the same facebook app ID with facebook SSO. Learn more in Adding Facebook Single Sign-on.
- ViewController - your UIViewController object.
- delegate: An object that conforms to the GSLoginUIDelegate protocol, delegate for the events fired by the 'Login' UI.
- context: A developer-created object that will be passed back unchanged to the application as one of the parameters of the GSResponseDelegate.gsDidReceiveResponse method.
showAddConnectionsUI
(void) showAddConnectionsUI:(GSObject*)params ViewController:(UIViewController *)MainViewController delegate:(id<GSAddConnectionsUIDelegate>)delegate context:(void*):context
Displays an "Add Connections" UI, which enables establishing connections to social networks.
The UI presents the available social network logos as connect options.
Parameters:
- params: may include the following fields:
- enabledProviders (optional) - a comma delimited list of providers that should be displayed on the UI. The list also defines the order in which the icons will be presented. The list of supported providers: 'facebook', 'twitter', 'yahoo', 'messenger', 'linkedin', 'myspace', 'orkut', 'foursquare', 'renren', 'vkontakte'.
- disabledProviders (optional) - a comma delimited list of providers that should not be displayed on the UI.
- captionText (optional) - sets the caption text.
- cid (optional) - a string of maximum 100 characters length. This string will be associated with each transaction and will later appear on reports generated by Gigya, in the "Context ID" combo box. The cid allows you to associate the report information with your own internal data. The "Context ID" combo box lets you filter the report data by application context.
- facebookSSOFallback (optional) - The parameter accepts two possible values: "webview" (default) or "safari". The parameter determines whether Gigya will open a webview or a Safari instance when trying to do SSO (Single Sign-On) while Facebook application is not installed.
- facebookAppId (optional) - The facebook app ID. This parameter is required if you implement facebook SSO. Learn more in Adding Facebook Single Sign-on.
- facebookLocalAppId (optional) - Set a local facebook app ID, if you have multiple facebook apps using the same facebook app ID with facebook SSO. Learn more in Adding Facebook Single Sign-on.
- ViewController - your UIViewController object.
- delegate: An object that conforms to the GSAddConnectionsUIDelegate protocol, delegate for the events fired by the 'Add Connections' UI.
- context: A developer-created object that will be passed back unchanged to the application as one of the parameters of the GSResponseDelegate.gsDidReceiveResponse method.
sendRequest
(void) sendRequest:(NSString*)method params:(GSObject*)params useHTTPS:(BOOL)useHTTPS delegate:(id<GSResponseDelegate>)delegate context:(void*):context
Send any request supported by our REST API.
Parameters:
- method: The method name. May be for example: "socialize.getUserInfo", "socialize.publishUserAction", etc. Please refer to our REST API for the entire reference. Please note that for security reasons, some methods are not supported from client side (e.g. accounts.search, reports.getCommentsStats, etc.).
- params: the request method parameters. Please refer to the relevant method API reference for the list of parameters.
- delegate: An object that conforms to the GSResponseDelegate protocol. The object will be invoked with the response received from the server.
sendRequest (with HTTPS)
(void) sendRequest:(NSString*)method params:(GSObject*)params useHTTPS:(BOOL)useHTTPS delegate:(id<GSResponseDelegate>)delegate context:(void*):context
Send any request supported by our REST API. Supports HTTPS override.
Parameters:
- method: The method name. May be for example: "socialize.getUserInfo", "socialize.publishUserAction", etc. Please refer to our REST API for the entire reference. Please note that for security reasons, some methods are not supported from client side (e.g. accounts.search, reports.getCommentsStats, etc.).
- params: the request method parameters. Please refer to the relevant method API reference for the list of parameters.
- useHTTPS: force usage of HTTPS
- delegate: An object that conforms to the GSResponseDelegate protocol. The object will be invoked with the response received from the server.
login
(void) login:(GSObject*)params ViewController:(UIViewController *)MainViewController delegate:(id<GSResponseDelegate>)delegate context:(void*):context
Login the user to a specified provider. Opens a WebDialog. The provider name is passed via the params (see Parameters below).
Parameters:
- params: may include the following fields:
- provider (mandatory) - The provider which will be used for authenticating the user. The following values are currently supported for use with this parameter:
facebook, twitter, yahoo, messenger, google, googleplus, linkedin, myspace, aol, foursquare, orkut, renren, qq, sina, kaixin, vkontakte, blogger, wordpress, typepad, paypal, livejournal, hyves, verisign, openid, netlog, signon, orangefrance, mixi, yahoojapan, spiceworks, livedoor, skyrock, vznet. - cid (optional) - a string of maximum 100 characters length. This string will be associated with each transaction and will later appear on reports generated by Gigya, in the "Context ID" combo box. The cid allows you to associate the report information with your own internal data. The "Context ID" combo box lets you filter the report data by application context.
- facebookReadPermissions (optional) - a comma delimited list of Facebook extended permissions to request from the user. This parameter gives the possibility to request extended permissions in addition to the permissions that Gigya is already requesting.
Please refer to Facebook's permissions documentation, for the complete list of permissions. The default value of this parameter is "email". Note: you should only include read permissions, otherwise Facebook will fail the login.
Note: use the socialize.getRawData method to pull the extra data. - googleExtraPermissions (optional) - this parameter gives the possibility to request extended permissions in addition to the permissions that Gigya is already requesting. The supported values are: "wallet" - for Google wallet permissions.
- forceAuthentication (optional) - the default value of this parameter is 'false'. If set to 'true', the user will be forced to provide her social network credentials during the login, even if she is already connected to the social network. Please note, that the behavior of the various social networks may be slightly different. For example, Facebook expects the current user to enter his password, and would not accept a different user name.
- pendingRegistration (optional) - The default value of this parameter is 'true'. The default behavior - the account is not considered final until socialize.notifyRegistration is called. While being not-final the identities associated with this account can be connected to another account without causing an
- facebookSSOFallback (optional) - The parameter accepts two possible values: "webview" (default) or "safari". The parameter determines whether Gigya will open a webview or a Safari instance when trying to do SSO (Single Sign-On) while Facebook application is not installed.
- facebookAppId (optional) - The facebook app ID. This parameter is required if you implement facebook SSO. Learn more in Adding Facebook Single Sign-on.
- facebookLocalAppId (optional) - Set a local facebook app ID, if you have multiple facebook apps using the same facebook app ID with facebook SSO. Learn more in Adding Facebook Single Sign-on.
- provider (mandatory) - The provider which will be used for authenticating the user. The following values are currently supported for use with this parameter:
- ViewController - your UIViewController object.
- delegate: An object that conforms to the GSResponseDelegate protocol, that will be invoked when the login process completes.
- context: A developer-created object that will be passed back unchanged to the application as one of the parameters of the GSResponseDelegate.gsDidReceiveResponse method.
logout
(void) logout
This method Logs out the current user of Gigya Platform. The method also logs out the user from the Social Networks, and clears WebDialog cookies and session. We highly recommend calling this method when the user logs out of the hosting site.
addConnection
(void) addConnection:(GSObject*)params ViewController:(UIViewController *)MainViewController delegate:(id<GSResponseDelegate>)delegate context:(void*):context
Add a Social Network connection to a specified provider for the current user.
Technically speaking, a connection is an established session with the social network and it expires according to the social network policy. A valid and active connection will give your application access to the user's social graph and ability to perform various social actions, such as publishing a newsfeed report to the connected social network.
Parameters:
- params: may include the following fields:
- provider (mandatory) - the name of the social network to connect to. The optional values for this parameter are: 'facebook', 'twitter', 'yahoo', 'messenger', 'linkedin', 'myspace', 'orkut', 'foursquare', 'renren', 'vkontakte'.
- cid (optional) - a string of maximum 100 characters length. This string will be associated with each transaction and will later appear on reports generated by Gigya, in the "Context ID" combo box. The cid allows you to associate the report information with your own internal data. The "Context ID" combo box lets you filter the report data by application context.
- facebookSSOFallback (optional) - The parameter accepts two possible values: "webview" (default) or "safari". The parameter determines whether Gigya will open a webview or a Safari instance when trying to do SSO (Single Sign-On) while Facebook application is not installed.
- facebookAppId (optional) - The facebook app ID. This parameter is required if you implement facebook SSO. Learn more in Adding Facebook Single Sign-on.
- facebookLocalAppId (optional) - Set a local facebook app ID, if you have multiple facebook apps using the same facebook app ID with facebook SSO. Learn more in Adding Facebook Single Sign-on.
- ViewController - your UIViewController object.
- delegate: An object that conforms to the GSResponseDelegate protocol, that will be invoked when the connection process completes.
- context: A developer-created object that will be passed back unchanged to the application as one of the parameters of the GSResponseDelegate.gsDidReceiveResponse method.
removeConnection
(void) removeConnection:(GSObject*)params delegate:(id<GSResponseDelegate>)delegate context:(void*):context
Removes an existing Social Network connection from the current user (the provider is specified via params).
Parameters:
- params: may include the following fields:
- provider (mandatory) - the name of the social network to disconnect from. The optional values for this parameter are: 'facebook', 'twitter', 'yahoo', 'messenger', 'linkedin', 'myspace', 'orkut', 'foursquare', 'renren', 'vkontakte'.
- cid (optional) - a string of maximum 100 characters length. This string will be associated with each transaction and will later appear on reports generated by Gigya, in the "Context ID" combo box. The cid allows you to associate the report information with your own internal data. The "Context ID" combo box lets you filter the report data by application context.
- delegate: An object that conforms to the GSResponseDelegate protocol, that will be invoked when the disconnect process completes.
- context: A developer-created object that will be passed back unchanged to the application as one of the parameters of the GSResponseDelegate.gsDidReceiveResponse method.
getSession
(GSSession *) getSession
Get the current session. returns nil if session doesn't exist. You may use this method to check if user is currently logged in:
if ([gsAPI getSession] != nil && [[gsAPI getSession] IsValid])
// user is logged-in
setSession
(void) setSession:(GSSession*)session;
Sets a new session. The method stores the session in the app's local storage. This method is designated for the case in which a user logs in to your app using your own login system (the app's username and password) instead of Gigya's social login. Learn more in Site Login - Synchronizing with Gigya Service guide.
Parameters:
- session (mandatory) - the new session. This is a GSSession object that must be initialized with the sessionToken and sessionSecret you have received from Gigya (in the response of the socialize.notifyLogin call).
setAPIDomain
(void) setAPIDomain:(NSString*)APIDomain;
Sets the domain used for making API calls. This method provides the option to override the default domain "gigya.com" and specify an alternative data center to be used.
Parameters:
- APIDomain (mandatory) - the domain of the data center to be used. For example: "eu1.gigya.com" for Europe data center.
requestFacebookPublishPermission
(void) requestFacebookPublishPermissions:(NSString*)permissions appId:(NSString*)appId localAppId:(NSString*)localAppId delegate:(id<GSResponseDelegate>)delegate context:(id)context;
Initiates requesting Facebook publish permissions from the user. This method works only with Facebook Single Sign-on.
Parameters:
- facebookPublishPermissions (mandatory) - a comma delimited list of Facebook publish permissions to request from the user. This parameter gives the possibility to request extended publish permissions in addition to the permissions that Gigya is already requesting.
Please refer to Facebook's permissions documentation, for the complete list of publish permissions. - appId (optional) - The facebook app ID. This parameter is required if you implement facebook SSO. Learn more in Adding Facebook Single Sign-on.
- localAppId (optional) - Set a local facebook app ID, if you have multiple facebook apps using the same facebook app ID with facebook SSO. Learn more in Adding Facebook Single Sign-on.
- delegate: An object that conforms to the GSResponseDelegate protocol, that will be invoked when the login process completes.
- context: A developer-created object that will be passed back unchanged to the application as one of the parameters of the GSResponseDelegate.gsDidReceiveResponse method.

Comments