You are here: Photobucket API Help > Examples > Logging In

Logging In

Many requests require you to log into Photobucket.  

Use the following API methods:

Web User Login

POST /login/request

User action

POST /login/response

Log a User into Photobucket

The examples that follow log a user into the Photobucket system.

Request a Login Token

Raw Request Example

  1. <timestamp> = 1208290131
  2. <nonce> = 5c4b38eb7e7f0a0603452dfb3bf149d7
  3. <method> = POST
  4. <url> = http://api.photobucket.com/login/request
  5. <params> = (none)
  6. <paramstring> = oauth_consumer_key=1020304&oauth_nonce=5c4b38eb7e7f0a0603452dfb3bf149d7&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1208290131&oauth_version=1.0
  7. <base> = POST&http%3A%2F%2Fapi.photobucket.com%2Flogin%2Frequest&oauth_consumer_key%3D1020304%26oauth_nonce%3D5c4b38eb7e7f0a0603452dfb3bf149d7%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1208290131%26oauth_version%3D1.0
  8. <signature> = jjF2U5hzxxEkTPFrX6GUkr8yl80=
  9. <authedurl> = http://api.photobucket.com/login/request
    1. Postdata: oauth_consumer_key=1020304&oauth_nonce=5c4b38eb7e7f0a0603452dfb3bf149d7&oauth_signature=jjF2U5hzxxEkTPFrX6GUkr8yl80%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1208290131&oauth_version=1.0

Raw Response Example

oauth_token=req_495c96a95b95e95f95_27502645&oauth_token_secret=a60ab06c06402d528ff&next_step=http%3A%2F%2Fapi.photobucket.com%2Fapilogin%2Flogin

  1. Parse response to extract oauth_token and oauth_token_secret for later use.
  2. Use next_step for the destination of the user in the Direct User to Login Page step that follows.

API Example (PHP)

  1. $resp = $api->login(‘request’)->post()->getResponseString();
  2. $api->loadTokenFromResponse();

Direct User to Login Page

Raw Request Example

(HTTP Header) Location: http://photobucket.com/apilogin/login?oauth_token= req_495c96a95b95e95f95_27502645

Raw Response Example

(Anticipate callback at specified URL)

API Example (PHP)

$api->goRedirect(‘login’);

Get Access Token

Raw Request Example

  1. <timestamp> = 1208290327
  2. <nonce> = 06ab696fc74d6fcf4a98f80ceb1c427f
  3. <method> = POST
  4.  <url> = http://api.photobucket.com/login/access
  5. <params> = oauth_token= req_495c96a95b95e95f95_27502645
  6. <token_secret> = a60ab06c06402d528ff (from request)
  7. <paramstring> = oauth_consumer_key=1020304&oauth_nonce=06ab696fc74d6fcf4a98f80ceb1c427f&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1208290327&oauth_token= req_495c96a95b95e95f95_27502645&oauth_version=1.0
  8. <base> = POST&http%3A%2F%2Fapi.photobucket.com%2Flogin%2Faccess&oauth_consumer_key%3D1020304%26oauth_nonce%3D06ab696fc74d6fcf4a98f80ceb1c427f%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1208290327%26oauth_token%3Dreq_495c96a95b95e95f95_27502645%26oauth_version%3D1.0
  9. <signature> = 2laqyLUGXg8Y1VxqC1nMx3X3OVI=
  10. <authedurl> = http://api.photobucket.com/login/access 
    1. Postdata: oauth_consumer_key=1020304&oauth_nonce=06ab696fc74d6fcf4a98f80ceb1c427f&oauth_signature=2laqyLUGXg8Y1VxqC1nMx3X3OVI%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1208290327&oauth_token=req_495c96a95b95e95f95_27502645&oauth_version=1.0

Raw Response Example

oauth_token=32.5726296_264620465&oauth_token_secret=c06406a063b06a06&username=pbapi&subdomain=api123.photobucket.com&homeurl=http%3A%2F%2Fs123.photobucket.com%2Falbums%2Fv101%2Fpbapi%2F

  1. Parse response to extract oauth_token and oauth_token_secret for later use.
  2. Parse username to see what user logged in (for subsequent calls) .
  3. Parse subdomain to get API domain where you will make user-related calls.
  4. Parse homeurl if you want to link to that user’s Photobucket album (HTML) .

API Example (PHP)

  1. $api->setOAuthToken($oauth_token, $oauth_token_secret); //from stored request
  2. $resp = $api->login(‘access)->post()->getResponseString();
  3. $api->loadTokenFromResponse();

 

Published 2-September-09. See developer.photobucket.com for additional resources.