FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
bazaar-api-php/examples/authorization.php at master · nikapps/bazaar-api-php · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
nikapps
/
bazaar-api-php
Public
Notifications
You must be signed in to change notification settings
Fork
2
Star
4
Code
Issues
0
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
bazaar-api-php
/
examples
/
authorization.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
26 lines (19 loc) · 731 Bytes
Breadcrumbs
bazaar-api-php
/
examples
/
authorization.php
Copy path
File metadata and controls
26 lines (19 loc) · 731 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
// 1. Create a client in your developer panel
// 2. Go to https://pardakht.cafebazaar.ir/devapi/v2/auth/authorize/?response_type=code&access_type=offline&redirect_uri=<REDIRECT_URI>&client_id=<CLIENT_ID>
// (<redirect url> is url of this script).
// 3. Store the refresh token
use
Nikapps
\
BazaarApi
\
Bazaar
;
use
Nikapps
\
BazaarApi
\
Config
;
require_once
__DIR__
.
'
/../vendor/autoload.php
'
;
$
bazaar
=
new
Bazaar
(
new
Config
([
'
client-secret
'
=>
'
your-client-secret
'
,
'
client-id
'
=>
'
your-client-id
'
]));
$
redirectUrl
=
'
http://example.com/callback
'
;
$
token
=
$
bazaar
->
token
(
$
redirectUrl
);
if
(
$
token
->
failed
()) {
echo
$
token
->
errorDescription
();
}
else
{
echo
"
Refresh Token:
"
.
$
token
->
refreshToken
();
}
Back
|
FazBrowse Home
|
New Git URL