Open topic with navigation
Logging In
Many requests require you to log into Photobucket.
Use the following API methods:
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
- <timestamp> = 1208290131
- <nonce> = 5c4b38eb7e7f0a0603452dfb3bf149d7
- <method> = POST
- <url> = http://api.photobucket.com/login/request
- <params> = (none)
- <paramstring> = oauth_consumer_key=1020304&oauth_nonce=5c4b38eb7e7f0a0603452dfb3bf149d7&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1208290131&oauth_version=1.0
- <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
- <signature> = jjF2U5hzxxEkTPFrX6GUkr8yl80=
- <authedurl> = http://api.photobucket.com/login/request
- 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
- Parse response to extract oauth_token and oauth_token_secret for later use.
- Use next_step for the destination of the user in the Direct User to Login Page step that follows.
API Example (PHP)
- $resp = $api->login(‘request’)->post()->getResponseString();
- $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
- <timestamp> = 1208290327
- <nonce> = 06ab696fc74d6fcf4a98f80ceb1c427f
- <method> = POST
- <url> = http://api.photobucket.com/login/access
- <params> = oauth_token= req_495c96a95b95e95f95_27502645
- <token_secret> = a60ab06c06402d528ff (from request)
- <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
- <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
- <signature> = 2laqyLUGXg8Y1VxqC1nMx3X3OVI=
- <authedurl> = http://api.photobucket.com/login/access
- 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
- Parse response to extract oauth_token and oauth_token_secret for later use.
- Parse username to see what user logged in (for subsequent calls)
.
- Parse subdomain to get API domain where you will make user-related calls.
- Parse homeurl if you want to link to that user’s Photobucket album (HTML)
.
API Example (PHP)
- $api->setOAuthToken($oauth_token, $oauth_token_secret); //from stored request
- $resp = $api->login(‘access)->post()->getResponseString();
- $api->loadTokenFromResponse();
Open topic with navigation