source: lib/oauth2.c @ 57b4525

Last change on this file since 57b4525 was 57b4525, checked in by Wilmer van der Gaast <wilmer@…>, at 2011-07-22T18:29:25Z

Nothing useful yet, this just generates an auth URL. Things to do: Ability
to process the answer. This is hard because the GTalk server will time out
very quickly which means we lose our state/scope/etc. (And the ability to
even receive the answer, at least if I'd do this the same way the Twitter
module does it.)

And then, get the access token and use it, of course. :-)

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/***************************************************************************\
2*                                                                           *
3*  BitlBee - An IRC to IM gateway                                           *
4*  Simple OAuth client (consumer) implementation.                           *
5*                                                                           *
6*  Copyright 2010-2011 Wilmer van der Gaast <wilmer@gaast.net>              *
7*                                                                           *
8*  This program is free software; you can redistribute it and/or modify     *
9*  it under the terms of the GNU General Public License as published by     *
10*  the Free Software Foundation; either version 2 of the License, or        *
11*  (at your option) any later version.                                      *
12*                                                                           *
13*  This program is distributed in the hope that it will be useful,          *
14*  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
15*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            *
16*  GNU General Public License for more details.                             *
17*                                                                           *
18*  You should have received a copy of the GNU General Public License along  *
19*  with this program; if not, write to the Free Software Foundation, Inc.,  *
20*  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.              *
21*                                                                           *
22\***************************************************************************/
23
24#include <glib.h>
25#include "oauth2.h"
26
27struct oauth2_service oauth2_service_google =
28{
29        "https://accounts.google.com/o/oauth2/",
30        "783993391592.apps.googleusercontent.com",
31        "k5_EV4EQ7jEVCEk3WBwEFfuW",
32};
33
34char *oauth2_url( const struct oauth2_service *sp, const char *scope )
35{
36        return g_strconcat( sp->base_url, "auth"
37                            "?scope=", scope,
38                            "&response_type=code"
39                            "&redirect_uri=urn:ietf:wg:oauth:2.0:oob",
40                            "&client_id=", sp->consumer_key,
41                            NULL );
42}
Note: See TracBrowser for help on using the repository browser.