Authentication

Cheezburger Authentication API

Allowing users to authenticate with their Cheezburger account and is a multi-step process in which the client creates a session request, sends the user to a specified url, and then waits for the user to activate the session. This browser-based system allows us to change the implementation of the authentication system without creating any breaking changes to your application.

  • Step 1. Create a new Authentication Session by issuing an HTTP POST
    Post a blank request to

    http://api.cheezburger.com/xml/authenticationsession

    Even though the POST body is blank, you still need to include the content-length header with a value of 0.

    From there, you wil get the following output.
    <?xml version="1.0" encoding="utf-8"?>
    <AuthenticationSessionResponse>
    <AuthenticationSessionId>http://api.cheezburger.com/xml/authenticationsession/8ed543b2-3058-46dd-942f-108037fc7f15</AuthenticationSessionId>
    <AuthenticationToken>8ed543b2-3058-46dd-942f-108037fc7f15</AuthenticationToken>
    <AuthorizationUrl>http://cheezburger.com/AuthorizeClient.aspx?token=8ed543b2-3058-46dd-942f-108037fc7f15</AuthorizationUrl>
    </AuthenticationSessionResponse>
  • Step 2. Open/embed a web browser and send the user to the URL specified in AuthorizationUrl.
    From there, a user will be prompted to log in or create a new account and log in. After the user logs in, they will see some details (name, url) about your application and either accept or reject the request.

  • Step 3. Check the Authentication Session
    Send a GET request to the AuthenticationSessionID

    http://api.cheezburger.com/xml/authenticationsession/{token}

    <?xml version="1.0" encoding="utf-8"?>
    <AuthenticationSession>
    <AuthenticationToken>8ed543b2-3058-46dd-942f-108037fc7f15</AuthenticationToken>
    <AuthorizationUrl>http://http://cheezburger.com/AuthorizeClient.aspx?Token=8ed543b2-3058-46dd-942f-108037fc7f15</AuthorizationUrl>
    <AuthenticationStatus>ACCEPTED|REJECTED|PENDING</AuthenticationStatus>
    <ClientId>http://api.cheezburger.com/xml/client/2001</ClientId>
    <AuthenticationTokenExpiration>2010-09-25T13:31:27.1799055-07:00</AuthenticationTokenExpiration>
    <Username>test-username</Username>
    <UserId>http://api.cheezburger.com/xml/user/exampleusername</UserId>
    </AuthenticationSession>
    Specifically, you should check if the AuthenticationStatus value is "ACCEPTED"

  • Step 4. Use The Authentication Token
    If you specify the "AuthenticationToken: {token}" header in all HTTP POST requests, the pictures and lols created will be associated with that user's account.

  • Step 5. Log out (optional)
  • To explicitly end the authentication session, you send an HTTP DELETE to the session id.

0 Comments

New comments are not being accepted at this time.