Oauth, openid and php 3

Moderator: Telldus

Post Reply
philarete
Posts: 54
Joined: Fri Mar 17, 2023 9:45 am

Oauth, openid and php 3

Post by philarete »

Hello :wave:
When i try to connect Telldu Live with API,
a page appears with "openid_mode" = "checkid_immediate"
saying:
//The website wants to access your profile.
//The information it asks for is:
// Email:
//Name:
//Do you trust the site?
Howdo you bypass that stuff ? I can't go overhead unless i'm not connected.
Last edited by philarete on Fri Sep 28, 2012 2:19 pm, edited 2 times in total.
micke.prag
Site Admin
Posts: 2243
Joined: Fri Mar 17, 2023 9:45 am
Location: Lund
Contact:

Re: Lightopenid and Telldus authentification

Post by micke.prag »

You should press the "Yes" button and the page will redirect you to the url you have supplied when getting your request-token.
Micke Prag
Software
Telldus Technologies
philarete
Posts: 54
Joined: Fri Mar 17, 2023 9:45 am

Re: Lightopenid and Telldus authentification

Post by philarete »

Thank you.
philarete
Posts: 54
Joined: Fri Mar 17, 2023 9:45 am

Re: Lightopenid and Telldus authentification

Post by philarete »

Ok, i fell anxious about OAuth
When i try to get connected thru OAuth, i get a
"Failed OAuth Request: Unknown request token ""
answer, whatever i do.
I'm using a web Apache server on a Linux computer. All is stored in /var/www/telldir
In order to be quiet, i did a chown www-data:www-data on all files, and a chmod 700
I installed PEAR without problems:
sudo pear install --alldeps --force HTTP_OAuth channel://pear.php.net/HTTP_OAuth-0.2.3
sudo apt-get install php-pear php5-dev make
I use the same files than Manticus in previous threads, i read all the forums about OAuth, i even get trhu TweeterAuth stuff in order to try and i do not see what the problem is:
common.php

Code: Select all

<?php
header('Content-Type: text/html; charset=utf-8');
session_start();
require_once 'HTTP/OAuth/Consumer.php';
define('KEY', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX');
define('SECRET', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX');
define('TOKEN', 'xxxxxxxxxxxxxxxxxxxxxxxxxx');
define('TOKEN_SECRET', 'xxxxxxxxxxxxxxxxxxxxxxxxxx');
define('URL', 'https://api.telldus.com'); //https should be used in production!
define('REQUEST_TOKEN', constant('URL').'/oauth/requestToken');
define('AUTHORIZE_TOKEN', constant('URL').'/oauth/authorize');
define('ACCESS_TOKEN', constant('URL').'/oauth/accessToken');
define('REQUEST_URI', constant('URL').'/xml');
define('BASE_URL', 'http://'.$_SERVER["SERVER_NAME"].dirname($_SERVER['REQUEST_URI']));
Here is getRequestToken.php

Code: Select all

<?php
header('Content-Type: text/html; charset=utf-8');
require_once 'common.php';
$consumer = new HTTP_OAuth_Consumer(constant('KEY'), constant('SECRET'));
$consumer -> getToken(constant('REQUEST_TOKEN'), constant('BASE_URL').'/getAccessToken.php');
$_SESSION['token']        = $consumer->getToken();
$_SESSION['token_secret'] = $consumer->getTokenSecret();
$url = $consumer->getAuthorizeUrl(constant('AUTHORIZE_TOKEN'));
header('Location:'.$url); 
The getAccess.php

Code: Select all

<?php
header('Content-Type: text/html; charset=utf-8');
require_once 'common.php';
$consumer = new HTTP_OAuth_Consumer(constant('KEY'), constant('SECRET'),$_SESSION['token'],$_SESSION['token_secret']);
//I even tried passing the secrete and tokens directly
try {
    $consumer->getAccessToken(constant('ACCESS_TOKEN')); 
$_SESSION['accessToken'] = $consumer->getToken();
$_SESSION['accessTokenSecret'] = $consumer->getTokenSecret(); 
 header('Location:index.php'); 
} catch (Exception $e) {
    ?>
        <p>Authorization failed!</p>
        <p><a href="index.php">Go back</a></p>
    <?php
}
If anyone could tell me what i did wrong would be very helpfull because at this point, the only thing i do with my tellnet is switching on 1 light. I feel like a BigBang theory guy !
Last edited by philarete on Fri Sep 28, 2012 12:42 pm, edited 1 time in total.
Zaman
Posts: 243
Joined: Fri Mar 17, 2023 9:45 am

Re: Lightopenid and Telldus authentification

Post by Zaman »

Did you generate and update the files with your Tokens/Keys?
Follow the instruction at the bottom of this page: http://api.telldus.com/
philarete
Posts: 54
Joined: Fri Mar 17, 2023 9:45 am

Re: Lightopenid and Telldus authentification

Post by philarete »

ty for your reply
yep of course i did.
I even tried a

Code: Select all

new HTTP_OAuth_Consumer(FEHUVEW84RA******,ZUXEVEGA9US***********,048b**********,dc7******
with these codes directly inside. But nothing.
Index drives me to login on telldus live (ok) and, after logging,
"Failed OAuth Request: Unknown request token ""
:|
philarete
Posts: 54
Joined: Fri Mar 17, 2023 9:45 am

Re: Lightopenid and Telldus authentification

Post by philarete »

Ok even after compiling Oauth manually, problem is the same.
Php3 + Oauth + API keys recently retrieved...
Even if i log manually and if write a test.php:

Code: Select all

$consumer2 = new HTTP_OAuth_Consumer(
constant('KEY'),
constant('SECRET'),
constant('TOKEN'),
constant('TOKEN_SECRET')); // WITH REAL API KEYS
result is
Authorization failed!
Could it be my keys are wrong ? UTF8 encodage ? anything wrong with UTF8 in telldus api ? Someone who wants to make me crazy ? :shock:
philarete
Posts: 54
Joined: Fri Mar 17, 2023 9:45 am

Re: Oauth, openid and php 3

Post by philarete »

Solved:
Ok, sorry for multiposting, bad humour, cynism and frustration.
The problem was my /var/www directory owner was www-data:www-data. Too restricted for Auth negociation.
.... :oops: .....
Ok, see you soon
Post Reply