Skip to content
This repository was archived by the owner on Nov 2, 2018. It is now read-only.
This repository was archived by the owner on Nov 2, 2018. It is now read-only.

Capturing the access code using server auth #34

@smithyco

Description

@smithyco

I'm trying to write a script that will call the API from the command line using the Artisan CLI.

Below is the test code from the Quickstart:

// Start the session
session_start();

// If we don't have an authorization code then get one
if (!isset($_GET['code'])) {
    header('Location: ' . $client->getLoginUrl());
    exit;
} else {
    $token = $client->getAccessToken($_GET['code']);
    echo json_encode($token); // Save this for future use
}

// You can now make requests to the API
$client->users()->search('skrawg');

How can I get the code from the returned URL without having to visit redirect URI?
If I visit that path in the browser, and retrieve the code manually and then try to set the access token with $token = $client->getAccessToken($manualCode), it throws an error because there's no state query parameter to verify CSRF.

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