Skip to content

Create access token without JSON #153

Open
@wesgood

Description

@wesgood

Many people use the bundle for APIs and one of the things that mobile apps require is a token immediately after registration, but the function grantAccessToken in OAuth2.php returns JSON instead of the token object. I separated the JSON return and token generation functions so that I can request a new token object and include in my registration data.

public function grantAccessToken(Request $request = NULL) {
    $token = $this->processAccessTokenRequest($request);
    return new Response(json_encode($token), 200, $this->getJsonHeaders());
  }

public function processAccessTokenRequest(Request $request = NULL) {
    // previous grantAccessToken function content
    return $this->createAccessToken($client, $stored['data'], $stored['scope']);
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions