forked from php-tmdb/api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding username and password authentication, failes for some reason a…
…nd added an ticket at TMDB API http://tmdb.lighthouseapp.com/projects/83077-api/tickets/358-improve-authentication-api#ticket-358-8. I suspect the api_key has to be ignored from the request as the request matches the earlier discussion in this ticket, but this would require extra work and actually doesn't make sense as all other authentication requests do require the api_key.
- Loading branch information
1 parent
b676689
commit cc0ec44
Showing
4 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ | |
/phpunit | ||
/public_html | ||
/cache.properties | ||
/tmdb.log |
31 changes: 31 additions & 0 deletions
31
examples/authentication/model/session_token_with_username_and_password.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
/** | ||
* This file is part of the Tmdb PHP API created by Michael Roterman. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @package Tmdb | ||
* @author Michael Roterman <[email protected]> | ||
* @copyright (c) 2013, Michael Roterman | ||
* @version 0.0.1 | ||
*/ | ||
require_once '../../../vendor/autoload.php'; | ||
require_once '../../../apikey.php'; | ||
|
||
$token = new \Tmdb\ApiToken(TMDB_API_KEY); | ||
$client = new \Tmdb\Client($token); | ||
|
||
$client->setLogging(true, '/www/dev/php-tmdb-api/tmdb.log'); | ||
|
||
$requestToken = new \Tmdb\RequestToken('db13650c7740b364efdc5413bd8781cb700efc64'); | ||
|
||
$authenticationRepository = new \Tmdb\Repository\AuthenticationRepository($client); | ||
|
||
$sessionToken = $authenticationRepository->getUsernamePasswordToken( | ||
$requestToken, | ||
TMDB_USERNAME, | ||
TMDB_PASSWORD | ||
); | ||
|
||
var_dump($sessionToken); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters