Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

token write #8

Open
shenmadouyaowen opened this issue Jul 15, 2016 · 0 comments
Open

token write #8

shenmadouyaowen opened this issue Jul 15, 2016 · 0 comments

Comments

@shenmadouyaowen
Copy link

hi, please help me . I do not know how to write this document token.php
token.php
<?php require_once 'vendor/autoload.php'; $storage = new Dingo\OAuth2\Storage\MySqlAdapter(new PDO('mysql:host=localhost;dbname=oauth2','root','root')); $server = new Dingo\OAuth2\Server\Authorization($storage); $server->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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant