OAuth::getAccessToken

(PECL OAuth >= 0.99.1)

OAuth::getAccessTokenFetch an access token

Beschreibung

public OAuth::getAccessToken(
    string $access_token_url,
    string $auth_session_handle = ?,
    string $verifier_token = ?,
    string $http_method = ?
): array

Fetch an access token, secret and any additional response parameters from the service provider.

Parameter-Liste

access_token_url

URL to the access token API.

auth_session_handle

Authorization session handle, this parameter does not have any citation in the core OAuth 1.0 specification but may be implemented by large providers. » See ScalableOAuth for more information.

verifier_token

For service providers which support 1.0a, a verifier_token must be passed while exchanging the request token for the access token. If the verifier_token is present in $_GET or $_POST it is passed automatically and the caller does not need to specify a verifier_token (usually if the access token is exchanged at the oauth_callback URL). » See ScalableOAuth for more information.

http_method

HTTP method to use, e.g. GET or POST.

Rückgabewerte

Returns an array containing the parsed OAuth response on success or false on failure.

Changelog

Version Beschreibung
PECL oauth 1.0.0 Gab früher bei einem Fehler null anstelle von false zurück.
PECL oauth 0.99.9 The verifier_token parameter was added

Beispiele

Beispiel #1 OAuth::getAccessToken() example

<?php
try {
    
$oauth = new OAuth(OAUTH_CONSUMER_KEY,OAUTH_CONSUMER_SECRET);
    
$oauth->setToken($request_token,$request_token_secret);
    
$access_token_info $oauth->getAccessToken("https://example.com/oauth/access_token");
    if(!empty(
$access_token_info)) {
        
print_r($access_token_info);
    } else {
        print 
"Failed fetching access token, response was: " $oauth->getLastResponse();
    }
} catch(
OAuthException $E) {
    echo 
"Response: "$E->lastResponse "\n";
}
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

Array
(
    [oauth_token] => some_token
    [oauth_token_secret] => some_token_secret
)

Siehe auch

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

Was genau bedeutet "Vibe Coding"? Ein tiefgehender Blick für Entwickler

In der Welt der Softwareentwicklung gibt es unzählige Wege, wie man an ein Projekt herangeht. Manche schwören auf strikte Planung, andere auf bewährte Algorithmen und wieder andere lassen sich von etwas ganz anderem leiten: ihrem Gefühl. ...

admin

Autor : admin
Kategorie: Software & Web-Development

PHP cURL-Tutorial: Verwendung von cURL zum Durchführen von HTTP-Anfragen

cURL ist eine leistungsstarke PHP-Erweiterung, die es Ihnen ermöglicht, mit verschiedenen Servern über verschiedene Protokolle wie HTTP, HTTPS, FTP und mehr zu kommunizieren. ...

TheMax

Autor : TheMax
Kategorie: PHP-Tutorials

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

Bild drehen

Konnten Sie das Bild erfolgreich drehen? Falls nicht, sollten Sie eine andere Methode ausprobieren, die effektiver ist. Slither io (https://slithe ...

Geschrieben von dorant am 28.05.2025 06:46:37
Forum: PHP Developer Forum
How to overcome Safari's iframe cookie block?

The fact that it requires user permission (a prompt) aligns perfectly with modern browser security and privacy principles. It's transparent and gi ...

Geschrieben von oliviawilde168 am 28.05.2025 04:57:49
Forum: HTML, JavaScript, AJAX, jQuery, CSS, Bootstrap, LESS
Bild drehen

Wenn du ein ikonisches Bild aus The Good, the Bad and the Ugly (z. B. Blondie, der dem sterbenden Soldaten seinen Mantel gibt) oder aus The Postma ...

Geschrieben von nanalyly am 27.05.2025 11:41:14
Forum: PHP Developer Forum
Google kauft WhatsApp-Konkurrenten Threema für fünf Milliarden Dollar

That’s really interesting, and it reminds me of when big tech companies started taking over popular apps I was using. I remember when Microsoft ...

Geschrieben von Chalmersas am 27.05.2025 06:52:00
Forum: Out of Order