Thread Perl mit OAuth2 und Strava (7 answers)
Opened by HomeAuto_User at 2020-02-23 15:00

HomeAuto_User
 2020-02-23 15:00
#191420 #191420
User since
2019-03-04
3 Artikel
BenutzerIn
[default_avatar]
Hallo,
ich möchte eine API nutzen um eine Schnittstelle zu erzeugen.
API Erläuterung Userhelp

Ich bitte um Mithilfe.
Folgende Schritte muss ich also umsetzen aber dies gelingt mir nicht.
# 1) Anfrage GET mit Kunden-ID, nicht athlete_id -->
# 2) Eingabe Login Daten
# 3) Return Browser nach authentication (with code)
# 4) Absetzen POST

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/perl
use strict;
use warnings;
use LWP::Authen::OAuth2;
use JSON;

# The client id and secret from the client_secret.json file
my $client_id = "081533311";
my $client_secret = "unknown";

# construct the OAuth2 object
my $oauth2 = LWP::Authen::OAuth2->new(
authorization_endpoint => 'https://www.strava.com/oauth/authorize',
client_id => $client_id, # your application’s ID, obtained during registration
client_secret => $client_secret, # APP-TOKEN
redirect_uri => "http://localhost/exchange_token", # from client_secret.json
approval_prompt => "force",
scope => "read",
);

# get the authentication url, give the user an opportunity to navigate to the
# url, copy the auth code, and paste it
my $url = $oauth2->authorization_url();

print "Authorization URL: $url\n";

Danke im Vorraus
Last edited: 2020-02-23 15:49:19 +0100 (CET)

View full thread Perl mit OAuth2 und Strava