dingo / dingo/oauth2-server

token write

Open
#8 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
79
Forks
25
PR merge metrics
No merged PRs in 30d

Description

hi, please help me . I do not know how to write this document token.php
token.php
`registerGrant(new Dingo\OAuth2\Grant\AuthorizationCode);
header('Content-Type: application/json');
echo json_encode($server->issueAccessToken());
`
client.php
`

array(
'method' => 'POST',
'header' => "Content-Type: text/xml\r\n".
"Authorization: Basic ".base64_encode("2222")."\r\n"
,
'content' => $body,
'timeout' => 60
)
);

$context = stream_context_create($opts);
$url = "http://cs.text.com/token.php?grant_type=code&code=PrioWzeeQIPkrILysuKZwGHtAu3hars7mdMXVkKS&client_id=id&client_secret=secret";
$result = file_get_contents($url, false, $context, -1, 40000);
var_dump($result);
`
Error:
Fatal error: Uncaught exception 'Dingo\OAuth2\Exception\ClientException' with message 'The request is missing the "grant_type" parameter.' in D:\php\WWW\oauth\vendor\dingo\oauth2-server\src\Server\Authorization.php:165 Stack trace: #0 D:\php\WWW\oauth\token.php(7): Dingo\OAuth2\Server\Authorization->issueAccessToken() #1 {main} thrown in D:\php\WWW\oauth\vendor\dingo\oauth2-server\src\Server\Authorization.php on line 165

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.