Removed mocks for oauth mastodon
This commit is contained in:
parent
bfc0bde05d
commit
564f81d5d5
|
@ -1,13 +1,12 @@
|
||||||
<?php require_once '/src/classes/database.php' ?>
|
<?php require_once '/src/classes/database.php' ?>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
# TODO: uncomment when done
|
|
||||||
if (false) {
|
|
||||||
$payload_fil = '/tmp/oauth-'.$ID;
|
$payload_fil = '/tmp/oauth-'.$ID;
|
||||||
if (!file_exists($payload_fil)) {
|
if (!file_exists($payload_fil)) {
|
||||||
header('Location: /signup'); die;
|
header('Location: /signup'); die;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# get mastodon auth token
|
||||||
$payload = json_decode(file_get_contents($payload_fil));
|
$payload = json_decode(file_get_contents($payload_fil));
|
||||||
$ch = curl_init($payload->instance.'/oauth/token');
|
$ch = curl_init($payload->instance.'/oauth/token');
|
||||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
||||||
|
@ -22,13 +21,8 @@ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
$auth = curl_exec($ch);
|
$auth = curl_exec($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
|
# get mastodon account info
|
||||||
$auth = @json_decode($output);
|
$auth = @json_decode($output);
|
||||||
}
|
|
||||||
|
|
||||||
# TODO: remove mock when done
|
|
||||||
$payload = json_decode(file_get_contents('/src/mock-payload.mock'));
|
|
||||||
$auth = json_decode(file_get_contents('/src/mock-auth.mock'));
|
|
||||||
|
|
||||||
$output = mastodon_get($payload->instance,
|
$output = mastodon_get($payload->instance,
|
||||||
'/api/v1/accounts/verify_credentials', $auth->access_token);
|
'/api/v1/accounts/verify_credentials', $auth->access_token);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue