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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.