Jump to content

Empire Avenue Oauth 2.0 help


SennNathan

Recommended Posts

This is the code im using to try to connect Empire Avenue API but i must be missing somthing here still trying to figure out all this Oauth stuff.

<?php



?>

<html>
<head>Empire Traider2</head>
<body>
<form method="post" action="https://www.empireavenue.com/profile/developer/authorize?client_id=app_543abbac2ad99&response_type=code&state=request_access_token">


<input type="submit" value="Login" />
</form>
</body>
</html>

 

Oauth.php

<?php
require('client.php');
require('GrantType/IGrantType.php');
require('GrantType/AuthorizationCode.php');

const CLIENT_ID = 'app_543abbac2ad99';
const CLIENT_SECRET = '1ee4b7f5d702d2c7e64523daf4d107b3dd82a0a787f117986d84f';

const REDIRECT_URI = 'https://yousearch.mobi/OAuth2/oauth.php';
const AUTHORIZATION_ENDPOINT = 'http://www.empireavenue.com/profile/developer/authorize';
const TOKEN_ENDPOINT = 'https://api.empireavenue.com/oauth/token';

$client = new OAuth2\Client(CLIENT_ID, CLIENT_SECRET);
if (!isset($_GET['code']))
{
$auth_url = $client->getAuthenticationUrl(AUTHORIZATION_ENDPOINT, REDIRECT_URI);
header('Location: ' . $auth_url);
die('Redirect');
}
else
{
$params = array('code' => $_GET['code'], 'redirect_uri' => REDIRECT_URI);
$response = $client->getAccessToken(TOKEN_ENDPOINT, 'authorization_code', $params);
parse_str($response['result'], $info);
$client->setAccessToken($info['access_token']);
$response = $client->fetch('https://api.empireavenue.com/profile/info');
echo $response;
echo 'test';
}
?>
 
Link to comment
https://forums.phpfreaks.com/topic/291626-empire-avenue-oauth-20-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.