iamstuartwilson / strava

PHP Class for the Strava API (v3)
MIT License
120 stars 26 forks source link

Clarification for testing #41

Open JKMcCloskey opened 4 years ago

JKMcCloskey commented 4 years ago

Hello,

I'm probably doing something wrong in testing, and could do with some clarification.

Initial problem report: In Strava API settings I have set the Authorization Callback Domain to localhost:8000

I have used "oauth-flow.php", from examples and I have the following set: define('CALLBACK_URL', 'http://localhost:8000/oauth-flow.php?action=callback');

Note I did move this from: ./strava-oauth-master/PHP2/vendor/iamstuartwilson/strava/examples/oauth-flow.php To: ./strava-oauth-master/PHP2/index.php

I setup a test server using: php -S localhost:8000/oauth-flow.php?action=callback

And get this response in terminal: PHP 7.1.23 Development Server started at Sat Nov 23 09:51:04 2019 Listening on http://localhost:8000/oauth-flow.php?action=callback Document root is /<VARIOUS_DIRECTORIES>/strava-oauth-master/PHP2 Press Ctrl-C to quit.

I then put this into the browser address bar: localhost:8000/oauth-flow.php?action=callback

And get an error "The requested resource /oauth-flow.php?action=callback was not found on this server."

Further testing conducted: I tried removing oauth-flow.php?action=callback from the CALLBACK_URL in the test php script as well as the command to launch the test server.

The result was that the webpage loads. I get an authorisation code in the browser address bar after clicking on "Start oAuth Authentication Flow". The authorisation code changes on each click.

When I click on "Refresh Access Token" I get the following:

Session Contents (before) Array ( [strava_access_token] => [strava_refresh_token] => [strava_access_token_expires_at] => ) Refresh Token Session Contents (after) Array ( [strava_access_token] => [strava_refresh_token] => [strava_access_token_expires_at] =>

Any ideas on what I'm doing wrong?

Many Thanks,

James