OAuth 2 Flow (Client-Side)

To authenticate a user using a side-side flow (which allows apps to authenticate a user without the need for a server) follow these steps:

Note: DailyCred's OAuth 2 flow is modeled after Facebook's implementation, and is nearly identical.

1. Redirect the user to your DailyCred OAuth Dialog

To begin the flow either popup a new window or redirect the user's browser to:

For testing on localhost, or to use a custom redirect url, include the redirect_uri parameter.

Tip: Be sure to add localhost as an accepted redirect domain in your account settings


Parameter NameDescription
client_idYour DailyCred client ID, found on the settings page.
response_typeTo use the client-side OAuth 2.0 flow, this parameter must be set as token.
redirect_uri (optional)The redirect url you wish the user to be sent to after authorization, specifying either a code for use to obtain an access token or an error message displaying that the user canceled authentication. This field is required if you do not specify a redirect url on your account page.
state (optional)You can use this option to help prevent cross-site request forgery. When your user is redirected after authenticating, the state parameter will be passed as well
referrer (optional)We allow this optional parameter as a way to keep track of what page the user was on when they went to sign in. This will be passed back as a 'referrer' parameter after the user signs in.

If the user cancels the request (by hitting the 'cancel' button on the authorization screen), the user will be redirected to:


2. Receive your Access Token

After the user either signs up or signs in through DailyCred, the user will be redirected to the specified 'redirect_uri' with a 'access_token' parameter in the url's hash fragment. Example:


3. Make requests to the DailyCred Graph API



Parameter NameDescription
access_tokenThe access token you were given in Step 2.

Example response

    "id": "xxxx243-b11e-xxx6-a493-a6xxxx2107b4",
    "email": "testuser@gmail.com",
    "created": "1342814188425",
    "guest": false

Here is an example of how to use the API with JQuery:

  if (document.location.hash.length !== 0){
    var token_query = document.location.hash.substring(1);
    var url = "https://www.dailycred.com/graph/me.json?client=[[YOUR_CLIENT_ID]]&" + token_query;
      url: url,
      dataType: 'json',
      success: function(data){
        window.user = data;
        // do something here!