Skip to content

token write #8

@shenmadouyaowen

Description

@shenmadouyaowen

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions