Ignore:
Timestamp:
2011-12-18T21:56:44Z (12 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
9b0ad7e
Parents:
18c6d36
Message:

Restructured and updated code a little bit to support new-style (much better
and "proper" OAuth2) Facebook OAuth support. (And, add wl.offline scope to get
tokens that don't expire after an hour.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/jabber.c

    r18c6d36 r64b6635  
    152152                        jd->oauth2_service = &oauth2_service_google;
    153153               
    154                 /* For the first login with OAuth, we have to authenticate via the browser.
    155                    For subsequent logins, exchange the refresh token for a valid access
    156                    token (even though the last one maybe didn't expire yet). */
    157                 if( strncmp( acc->pass, "refresh_token=", 14 ) != 0 )
     154                /* First see if we have a refresh token, in which case any
     155                   access token we *might* have has probably expired already
     156                   anyway. */
     157                if( strstr( acc->pass, "refresh_token=" ) )
     158                {
     159                        sasl_oauth2_refresh( ic, acc->pass + 14 );
     160                }
     161                /* If we don't have a refresh token, let's hope the access
     162                   token is still usable. */
     163                else if( strstr( acc->pass, "access_token=" ) )
     164                {
     165                        sasl_oauth2_load_access_token( ic );
     166                        jabber_connect( ic );
     167                }
     168                /* If we don't have any, start the OAuth process now. Don't
     169                   even open an XMPP connection yet. */
     170                else
    158171                {
    159172                        sasl_oauth2_init( ic );
    160173                        ic->flags |= OPT_SLOW_LOGIN;
    161174                }
    162                 else
    163                         sasl_oauth2_refresh( ic, acc->pass + 14 );
    164175        }
    165176        else
Note: See TracChangeset for help on using the changeset viewer.