On Mon, 2013-07-29 at 16:18 +0300, Amarnath Valluri wrote:
> On 07/29/2013 04:08 PM, Patrick Ohly wrote:
>> On Mon, 2013-07-29 at 14:39 +0200, Patrick Ohly wrote:
>>> On Mon, 2013-07-29 at 09:39 +0000, Valluri, Amarnath wrote:
>>>>> When using my own client ID/secret for an app for which I have
enabled
>>>>> the CalDAV API, I get an error about the scope "email"
hard-coded in the
>>>>> example. Not surprising. So, which Google API do I need to enable
for
>>>>> the example? I looked for "GMail" or "mail", but
that is not currently
>>>>> offered to me.
>>>> [Amarnath] A wild guess : Scope is 'calendar' in this case.
>>> I had an error in my command line (wrong combination of client
>>> ID/secret). After fixing that, I was able to get a token for
"email".
>>> After recompiling with "calendar", it fails immediately without
popping
>>> up a dialog:
>>>
>>> ** (lt-google-oauth2-example:19038): WARNING **: get_google_token_cb:
>>> GDBus.Error:com.google.code.AccountsSSO.gSingleSignOn.Error.NotAutherized:
Authorization server returned an error: invalid_request
>>>
>>> Is that because "calendar" is invalid or because there is some
cached
>>> state somewhere?
>> This example here uses "https://www.googleapis.com/auth/calendar":
>>
>>
https://developers.google.com/google-apps/calendar/instantiate
>>
>> However, I still get the same "invalid_request" error.
>>
>> Note that this page here says that "scope" must be "openid
email" or
>> "openid profile":
>>
https://developers.google.com/accounts/docs/OAuth2Login
>>
>> I've tried:
>> g_hash_table_insert (params, "Scope", g_variant_new_string
("email
https://www.googleapis.com/auth/calendar"));
>>
>> Didn't help either. Is it correct to enter different scope strings as
>> space-separated words?
>>
>> Anyway, I'm stuck on this one, some help would be appreciated.
>>
> Your are almost there, the right scope to use is :
> "https://www.googleapis.com/auth/calendar"
>
> g_hash_table_insert (params, "Scope", g_variant_new_string
("https://www.googleapis.com/auth/calendar"));
Already tried that when I saw the example that I mentioned above,
doesn't work here.
Does it work for you?
Yes, It worked for me :
-----------------------------
~/work/code.google.com/libgsignon-glib/examples$ ./google-oauth2-example
--get-google-token=5
--client-id="796629365126.apps.googleusercontent.com"
--client-secret="3NbR94RM-DTnA81BWjiJe4TP"
Geting token
Got token :{'AccessToken':
<'ya29.AHES6ZS7RpdHAoikzv0ZdV-2xpPDUXMJkFCcaNpz6r3_G5k'>,
'TokenParameters': <@a{sv} {}>, 'TokenType':
<'Bearer'>, 'Duration':
<int64 3596>, 'Timestamp': <int64 1375105096>, 'Scope':
<'https://www.googleapis.com/auth/calendar'>}
--------------------------
The only changes i did was - RedirctURI and Scope.
-Amarnath
---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki
Business Identity Code: 0357606 - 4
Domiciled in Helsinki
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.