Skip to content

Commit

Permalink
Merge pull request #32 from clementmas/master
Browse files Browse the repository at this point in the history
Define Callback URI
  • Loading branch information
RichieMcMullen authored May 14, 2023
2 parents 2560559 + 2f3f958 commit 46b1e01
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/Strava.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,17 @@ public function __construct($CLIENT_ID, $CLIENT_SECRET, $REDIRECT_URI, $GUZZLE_C
#
# Strava Authenticate
#
public function authenticate($scope='read_all,profile:read_all,activity:read_all')
{
return redirect('https://www.strava.com/oauth/authorize?client_id='. $this->client_id .'&response_type=code&redirect_uri='. $this->redirect_uri . '&scope=' . $scope . '&state=strava');
public function authenticate($scope = 'read_all,profile:read_all,activity:read_all', $redirect_uri = null)
{
$query = http_build_query([
'client_id' => $this->client_id,
'response_type' => 'code',
'redirect_uri' => $redirect_uri ?: $this->redirect_uri,
'scope' => $scope,
'state' => 'strava',
]);

return redirect("https://www.strava.com/oauth/authorize?{$query}");
}


Expand Down

0 comments on commit 46b1e01

Please sign in to comment.