ef01cfc7c638e6b9a23e7d05ec47f0f9a95395c1
[friendica.git/.git] / src / Security / OAuth1 / OAuthToken.php
1 <?php
2
3 namespace Friendica\Security\OAuth1;
4
5 use Friendica\Security\OAuth1\OAuthUtil;
6
7 class OAuthToken
8 {
9         // access tokens and request tokens
10         public $key;
11         public $secret;
12
13         public $expires;
14         public $scope;
15         public $uid;
16
17         /**
18          * key = the token
19          * secret = the token secret
20          *
21          * @param $key
22          * @param $secret
23          */
24         function __construct($key, $secret)
25         {
26                 $this->key    = $key;
27                 $this->secret = $secret;
28         }
29
30         /**
31          * generates the basic string serialization of a token that a server
32          * would respond to request_token and access_token calls with
33          */
34         function to_string()
35         {
36                 return "oauth_token=" .
37                            OAuthUtil::urlencode_rfc3986($this->key) .
38                            "&oauth_token_secret=" .
39                            OAuthUtil::urlencode_rfc3986($this->secret);
40         }
41
42         function __toString()
43         {
44                 return $this->to_string();
45         }
46 }