Jump to content
View in the app

A better way to browse. Learn more.

Invision Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Little logging improvement for OAuth2 auth

Featured Replies

In method _exchangeAuthorizationCodeForAccessToken we have just throw new \IPS\Login\Exception( 'generic_error', \IPS\Login\Exception::INTERNAL_ERROR ); if something happened with $response. Now I implement Sony Playstation Network OAuth2 and got non-standard answer at this responce in HTML, not json. So decodeJson() on the response returned NULL and nothing logged in $responce checks.

Will be much better, if this method will check \RuntimeException throwing on the $response and log plain response if it not json.

For example, it might look like that:

    protected function _exchangeAuthorizationCodeForAccessToken($code)
    {
        /* Make the request */
        $data = $this->_authenticatedRequest($this->tokenEndpoint(), array(
            'grant_type'   => 'authorization_code',
            'code'         => $code,
            'redirect_uri' => (string)$this->redirectionEndpoint(),
        ));
        try {
            $response = $data->decodeJson();
        } catch (\RuntimeException $e) {
            \IPS\Log::log(print_r($data, true), 'oauth');
            throw new \IPS\Login\Exception('BAD_JSON', \IPS\Login\Exception::INTERNAL_ERROR);
        }

        // other code not changed...
    }

Thanks.

Something went wrong. Empty error log. <= tags for search if somebody catches the same problem. :cool:

Edited by Upgradeovec

Archived

This topic is now archived and is closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.