StesCodes

Documentation of Social Login version 1.0

The StesCodes Social Login provides the ability to login the user in clicks. The DLL is compatible in both shared and dedicated servers. It supports .net framework 3.5 and above, also supports C# and VB.net. The below is the technical document to configure the social login.
 

AutoUpdate DLL

Autoupdate is the first step in configuring StesCodes Social Login, which will check for updates once every day. Once a update is found, the DLL will download the latest DLL from StesCodes server and update your old DLL automatically. Inorder to perform a manual update, you have to remove a file called "stescodes.im"(which keeps track of update) from your server and start grabbing for any of the service; which will basically force the update process to happen. Most importantly your project bin folder should have read/write permission. We recommend you to check the permission settings HERE. You shall download the autoupdate DLL by login to StesCodes ( http://stescodes.com/sourceupdate.aspx) and download your source code which contains the autoupdate.dll file.

checkforupdate(this.Context, signature);

Parameters

Please import namespace "autoupdate"
Parameters Description Required?
1. Context Gets the System.Web.HttpContext object associated with the page Yes
2. Signature Signature Key provided during purchase(license key) Yes
3. Bin Path The physical path to your bin directory to update the DLL. If this parameter were not passed then the default bin location inside the current directory will be choosen to update the DLL. If IMfile path is provided then the path to bin folder should be provided. eg: D:\myproject\bin (no slash after path) Optional
4. IMfile The physical path to some directory where stescodes.im file need to be saved. The IMfile save the information about the updates, so if this file location is passed as 4th parameter then this file location should be passed on "getUserInformation" function as additional parameter. The directory should be provided with write permission. If IMfile path is provided then the path to bin folder should be provided. eg: D:\myproject\somepath (no slash after path) Optional
back to top

Social Login

The next step after integrating autoupdate feature, is the Social Login integration.

Reference

  • Add reference to StesCodes_SL.dll
  • Import the namespace "StesCodes_SocialLogin"
back to top

Settings

Add the below appsettings on your web.config file


    <add key="licensekey" value="StesCodes signature key here"/>
    
    
    <add key="FBApiKey_" value="your facebook api key"/>
    <add key="FBSecretKey_" value="your facebook api secret key"/>
    
    <add key="consumerKey_twitter" value="your twitter api key"/>
    <add key="consumerSecret_twitter" value="your twitter api secret key"/>

    <add key="LiApiKey" value="your linkedin api key" />
    <add key="LiSecretKey" value="your linkedin api secret key" />

    <add key="GPlusApiKey" value="your googleplus api key"/>
    <add key="GPlusSecretKey" value="your googleplus api secret key"/>

    <add key="GoogleApiKey" value="your google api key"/>
    <add key="GoogleSecretKey" value="your google api secret key"/>

    <add key="OrkutApiKey" value="your orkut api key"/>
    <add key="OrkutSecretKey" value="your orkut api secret key"/>

    <add key="consumerKey_yahoo" value="your yahoo api key"/>
    <add key ="consumerSecret_yahoo" value="your yahoo api secret key"/>

    <add key="consumerKey_myspace" value="your myspace api key"/>
    <add key ="consumerSecret_myspace" value="your myspace api secret key"/>

    <add key="wll_appid" value="your live api key"/>
    <add key="wll_secret" value="your live api secret key"/>

    <add key="consumerKey_foursquare" value="your foursquare api key"/>
    <add key ="consumerSecret_foursquare" value="your foursquare api secret key"/>

    <add key="AOL_developerkey" value="your aol api key"/>

    <add key="soundcloudApiKey" value="your soundcloud api key"/>
    <add key="soundcloudSecretKey" value="your soundcloud api secret key"/>

    <add key="MeetupApiKey" value="your meetup api key"/>
    <add key="MeetupSecretKey" value="your meetup api secret key"/>

    <add key="GithubApiKey" value="your github api key"/>
    <add key="GithubSecretKey" value="your github api secret key"/>

    <add key="lastfmApiKey" value="your lastfm api key"/>
    <add key="lastfmSecretKey" value="your lastfm api secret key"/>

    <add key="upcommingApiKey" value="your upcoming api key"/>

    <add key="consumerKey_flickr" value="your flickr api key"/>
    <add key ="consumerSecret_flickr" value="your flickr api secret key"/>
    
            
back to top

Login/Register

In-order to start social login, you have to make request to three functions

  1. getAuthenticationUrl
  2. getAccessToken
  3. getUserInformation

To configure API keys, click here How to configure API keys.

Function for getAuthenticationUrl

getAuthenticationUrl(servicename, ConsumerKey, ConsumerSecret, callbackurl);

Parameters

Parameters Description Required?
1. ServiceName Service Name refers to the social networks. Inorder to access a service use the below reference keywords
facebook, gplus, twitter, linkedin, google, yahoo, aol, live, myspace, flickr, foursquare, soundcloud, openid, meetup, github, lastfm, upcoming and orkut.
Yes
2. ConsumerKey Consumer key(API Key) which you received after registering you application on facebook, gplus, twitter, linkedin, google, yahoo, aol, live, myspace, flickr, foursquare, soundcloud, openid, meetup, github, lastfm, upcoming and orkut. Yes
3.ConsumerSecret Consumer Secret(APi Secret) which you received after registering you application on facebook, gplus, twitter, linkedin, google, yahoo, aol, live, myspace, flickr, foursquare, soundcloud, openid, meetup, github, lastfm, upcoming and orkut. Yes
4. callbackurl CallbackURL is the return url which is used, once the user is redirected to authorize, he/she will be redirected to the callbackurl (note: sometimes you might get error with callbackurl between www.xx.com and xx.com, so carefull with www) Yes

Return type

The return type is collection.
  1. authUrl
  2. token
  3. tokenSecret
  4. tokenVerifier
  5. UID
  6. error
back to top

Function for getAccessToken

getAccessToken(servicename, token, tokensecret, tokenverifier, callbackurl, ConsumerKey, ConsumerSecret);

Parameters

Parameters Description Required?
1. ServiceName Service Name refers to the mail servers. Inorder to access a service use the below reference keywords
facebook, gplus, twitter, linkedin, google, yahoo, aol, live, myspace, flickr, foursquare, soundcloud, openid, meetup, github, lastfm, upcoming and orkut.
Yes
2. Token Token which you received through callback url after user redirection from authorization page. Yes
3. TokenSecret TokenSecret which you receive from "getAuthenticationUrl" as return parameters. Yes/No
4. TokenVerifier TokenVerifier which you received through callback url after user redirection from authorization page. Yes/No
5. callbackurl CallbackURL is the return url which is used, once the user is redirected to authorize, he/she will be redirected to the callbackurl (note: sometimes you might get error with callbackurl between www.xx.com and xx.com, so carefull with www) Yes
6. ConsumerKey Consumer key(API Key) which you received after registering you application on facebook, gplus, twitter, linkedin, google, yahoo, aol, live, myspace, flickr, foursquare, soundcloud, openid, meetup, github, lastfm, upcoming and orkut. Yes
7.ConsumerSecret Consumer Secret(APi Secret) which you received after registering you application on facebook, gplus, twitter, linkedin, google, yahoo, aol, live, myspace, flickr, foursquare, soundcloud, openid, meetup, github, lastfm, upcoming and orkut. Yes

Return type

The return type is collection.
  1. authUrl
  2. token
  3. tokenSecret
  4. tokenVerifier
  5. UID
  6. error
back to top

Function for getUserInformation

getUserInformation(servicename, token, tokensecret, tokenverifier, UID, ConsumerKey, ConsumerSecret, OpenIDData, this.context, IMFile path);

Parameters

Parameters Description Required?
1. ServiceName Service Name refers to the mail servers. Inorder to access a service use the below reference keywords
facebook, gplus, twitter, linkedin, google, yahoo, aol, live, myspace, flickr, foursquare, soundcloud, openid, meetup, github, lastfm, upcoming and orkut.
Yes
2. Token Token which you received from "GetAccessToken" as return parameter. Yes
3. TokenSecret TokenSecret which you receive from "GetAccessToken" as return parameters. Yes/No
4. TokenVerifier TokenVerifier which you receive from "GetAccessToken" as return parameters. Yes/No
5. UID UserID which you receive from "GetAccessToken" as return parameters. Yes/No
6. ConsumerKey Consumer key(API Key) which you received after registering you application on facebook, gplus, twitter, linkedin, google, yahoo, aol, live, myspace, flickr, foursquare, soundcloud, openid, meetup, github, lastfm, upcoming and orkut. Yes
7.ConsumerSecret Consumer Secret(APi Secret) which you received after registering you application on facebook, gplus, twitter, linkedin, google, yahoo, aol, live, myspace, flickr, foursquare, soundcloud, openid, meetup, github, lastfm, upcoming and orkut. Yes
8. OpenIDData OpenIDData which you receive from "getOpenIdData" as return parameters. Pass empty object for service except AOL and OpenID. Yes/No
9. Context Gets the System.Web.HttpContext object associated with the page Yes
10. IMfile If you provide the IMfile path as additional parameter to autoupdate function, then you have to provide the same path here as well. eg: D:\myproject\somepath (no slash after path) Optional

Return Types

The return type is collection.
  1. aboutme
  2. id
  3. displayName
  4. firstName
  5. lastName
  6. email
  7. profileUrl
  8. photo
  9. location
  10. phone
  11. gender
  12. relationship
  13. dob
  14. error
back to top

Function for getOpenIDAuthURL

getOpenIDAuthURL(username, servicename, callbackurl, domainurl);

Parameters

Parameters Description Required?
1. username Open ID user name. Yes
2. servicename Service Name refers to the openid provider name. Inorder to access a service use the below reference keywords Yes
3. callbackurl CallbackURL is the return url which is used, once the user is redirected to authorize, he/she will be redirected to the callbackurl (note: sometimes you might get error with callbackurl between www.xx.com and xx.com, so carefull with www) Yes
4. domainurl Your domain url Yes

Return type

The return type is string.
  1. openidurl
back to top

Function for getOpenIdData

getOpenIdData(username, querystringallvalue);

Parameters

Parameters Description Required?
1. username Open ID user name. Yes
2. querystringallvalue All the querystringvalue ex: token=XXXXXX&openid=YYYYYY&url=ZZZZZ Yes

Return type

The return type is collection.
  1. aboutme
  2. dob
  3. email
  4. fname
  5. gender
  6. id
  7. lname
  8. location
  9. nickname
  10. phone
  11. photo
  12. profilelink
  13. relationship
back to top

Debugging

Debugging Windows Live:

Debugging for Hotmail, MSN and msnmessenger is hard when compared to other services because in OAuth method, for the three services, you receive the token in post data other than in querystring. So follow the below steps to debug in local
  1. Upload the socialoauth.aspx page to your server.
  2. Do the below five steps when the user is redirected after authentication.
  3. Get the post data and construct as a url with querystring parameter(for ex: token=xxx&tokensecret=yyyy as http://youdomain.com/auth.aspx?token=xxx&tokensecret=yyyy)
  4. After constructing the parameter change the constructed url to localhost url(for ex: http://youdomain.com/auth.aspx?token=xxx&tokensecret=yyyy to http://localhost:2345/yourproject/auth.aspx?token=xxx&tokensecret=yyyy
  5. Redirect to the localhost url(for ex: Response.Redirect(http://localhost:2345/yourproject/auth.aspx?token=xxx&tokensecret=yyyy);)
  6. Now you will get the token in localhost for debugging.
  7. Remove the redirection part after you done with your debugging.
back to top

Binding

Once the informations are grabbed and received in collection object, you can bind the data to front end for registration process or check with the database for existance of the user and if exist login.
back to top

Error Handling

There are few error messages you need to taken care on your end

Error Message

Error Description
1. Invalid domain The license(Signature Key) is not registered for this domain. You shall change/edit your domain here http://stescodes.com/sourceupdate.aspx
2. Invalid key The Signature Key is invalid.
3. File missing! add code to check update Please include the code for autoupdate or some times the path to Imfile was not located. So pass the IMfile location as additional parameter to the grabbing function.
4. Add code to check update Please include the code for autoupdate.
5. This service not available on your plan The service you are requesting to grab information are not available on your purchased plan.
back to top

Configurations

Inorder to perform the autoupdate process successfully, your project should be read/write enabled. Once found update, two files will be updated, one is Social Login dll which is inside bin folder and other is stescodes.im which is outside the bin folder. The stescodes.im file has the details of update info.

If you don't want to provide write permission for the entire project, then follow the below steps:

  • Create a folder with write permission or specify a folder with write permission for IMfile
  • Pass the location of folder to "checkforupdate" function as fourth parameter(eg: checkforupdate(this.Context, signature,bin location,IMfile location);)
  • Also specify the path as additional parameter to "getUserInformation"(specify as additional parameter) function

Permissions

Inorder to perform the autoupdate process successfully, your project should be read/write enabled.
back to top

Turn On/Off AutoUpdate

Turn OFF:

In order to turn off autoupdate, login to http://stescodes.com/sourceupdate.aspx then click OFF button. Once autoupdate is set OFF, the DLL with latest updates will not be updated on your server automatically, you have to manually update by downloading the latest DLL from customer login. No need to providing write permission for bin folder.

Even though you turn OFF the autoupdate feature, you should have the below on your project.

  • Either you should create a folder with write permission OR provide write permission to root folder. This process is necessary for the stescodes.im file to be created which keeps track of the service validations.
  • If you create a folder with write permission then specify that location as parameter for "autoupdate" function and "getUserInformation" function(refer above for passing parameter).

Turn ON:

In order to turn ON autoupdate, login to http://stescodes.com/sourceupdate.aspx then click ON button. Once autoupdate is set ON, the DLL with latest updates will be updated on your server automatically.

If you turn ON the autoupdate feature, you should have the below on your project

  • Either you should create a folder with write permission OR provide write permission to root folder.
  • If you create a folder with write permission then specify that location as parameter for "autoupdate" function and "getUserInformation" function(refer above for passing parameter).

back to top

Change Domain

If you get the domain is invalid and you purchased license for that domain, then you shall follow the below steps to update your domain.

Edit/Change Domain

To edit or change your domain
  • Login to http://stescodes.com/sourceupdate.aspx
  • You shall login using email and password which you received in email during purchase or you shall use the StesCodes transaction id
  • Once you login, click the edit link near website
  • Enter the domain details
  • Click "proceed" to save.
back to top
HOME | TERMS OF SERVICE | PRODUCT | CONTACT US | PRIVACY POLICY | FAQ | SITE MAP
Copyright 2011 stescodes.com