Why keep redirecting to wp-login?
-
To apply the oauth function to the rest api, I set it as follows.
https://localhost/customdev/oauthcb/authorization_code-1.php# authorization_code-1.php <?php # require('Client.php'); # require('GrantType/IGrantType.php'); # require('GrantType/AuthorizationCode.php'); require("vendor/autoload.php"); const CLIENT_ID = 'U988ri1rs3XRZVrqwOAxXLi3QjmUu3TKBlOUTGZ8'; const CLIENT_SECRET = 'O0jXuRxwHt1Kcq3uZWG0AouefXupgvrJp7mYKqqq'; const REDIRECT_URI = 'https://localhost/customdev/oauthcb/authorization_code-1.php'; const AUTHORIZATION_ENDPOINT = 'https://localhost/oauth/authorize'; const TOKEN_ENDPOINT = 'https://localhost/oauth/token'; $client = new OAuth2\Client(CLIENT_ID, CLIENT_SECRET); if (!isset($_GET['code'])) { $auth_url = $client->getAuthenticationUrl(AUTHORIZATION_ENDPOINT, REDIRECT_URI); header('Location: ' . $auth_url); die('Redirect'); } else { $params = array('code' => $_GET['code'], 'redirect_uri' => REDIRECT_URI); $response = $client->getAccessToken(TOKEN_ENDPOINT, 'authorization_code', $params); echo "<pre>"; print_r($response); # parse_str($response['result'], $info); # $client->setAccessToken($info['access_token']); # $response = $client->fetch('https://graph.facebook.com/me'); # var_dump($response, $response['result']); }
https://wp-oauth.com/docs/how-to/setup-wp-oauth-server-for-single-sign-on-with-wordpress/
There is a similar example, so I followed it. It doesn’t seem to work.However, different from the applied value, it is redirected to /wp-login.php
I set it to two things, authorization_code and implicit.
I also turned off the “jetpack brute force protection” feature.
I’ve tested it on both staging and production sites and it doesn’t works.
(The staging site is a subdomain method)Why doesn’t works?
Why do I keep redirecting to wp-login?The docs docs do not provide detailed explanations for these issues.
- The topic ‘Why keep redirecting to wp-login?’ is closed to new replies.