librelist archives

« back to archive

URLs with #

URLs with #

From:
Sherjil Ozair
Date:
2012-07-22 @ 22:06
Hello list,

I'm new to flask and am trying to integrate "login using google" using the
documentation here: https://developers.google.com/accounts/docs/OAuth2

However, a problem arises when the callback url is like this:

http://localhost:5000/oauth2callback#access_token={token}&token_type=Bearer&expires_in=3600

That is, instead of '?', they are using '#' to separate the parameters.
Flask does not require this as GET parameters.

How to handle this?

Thanks,
Regards,
Sherjil Ozair

Re: [flask] URLs with #

From:
Xuanyi Chew
Date:
2012-07-22 @ 22:15
# represents anchors - specifically named anchors in HTML. In this case,
you'd need javascript to intercept your named anchors, but it shouldn't be
the case since it's a callback, and you provided the callback redirect uri
to the oauth to begin with.

If I were you, I'd check your own code to see if you're using # instead of
?


Xuanyi Chew
Co-founder, edgeyo
+61403928398

edgeyo is an active matching platform for investors and entrepreneurs. Lean
startups, meet lean funding. Find out more at http://edgeyo.com


On Mon, Jul 23, 2012 at 8:06 AM, Sherjil Ozair <sherjilozair@gmail.com>wrote:

> Hello list,
>
> I'm new to flask and am trying to integrate "login using google" using the
> documentation here: https://developers.google.com/accounts/docs/OAuth2
>
> However, a problem arises when the callback url is like this:
> 
http://localhost:5000/oauth2callback#access_token={token}&token_type=Bearer&expires_in=3600
>
> That is, instead of '?', they are using '#' to separate the parameters.
> Flask does not require this as GET parameters.
>
> How to handle this?
>
>  Thanks,
> Regards,
> Sherjil Ozair
>

Re: [flask] URLs with #

From:
Sherjil Ozair
Date:
2012-07-22 @ 22:26
Hi Xuanyi,

No, I'm not using the # anywhere. The Google API is sending back results
using #. I think, they only mean this to be in javascript.

Is there any other easy way to put a simple 'login using google' button on
my website. I can't seem to find anything easy.

Sherjil Ozair

On Mon, Jul 23, 2012 at 3:45 AM, Xuanyi Chew <chewxy@gmail.com> wrote:

> # represents anchors - specifically named anchors in HTML. In this case,
> you'd need javascript to intercept your named anchors, but it shouldn't be
> the case since it's a callback, and you provided the callback redirect uri
> to the oauth to begin with.
>
> If I were you, I'd check your own code to see if you're using # instead of
> ?
>
>
> Xuanyi Chew
> Co-founder, edgeyo
> +61403928398
>
> edgeyo is an active matching platform for investors and entrepreneurs.
> Lean startups, meet lean funding. Find out more at http://edgeyo.com
>
>
>
> On Mon, Jul 23, 2012 at 8:06 AM, Sherjil Ozair <sherjilozair@gmail.com>wrote:
>
>> Hello list,
>>
>> I'm new to flask and am trying to integrate "login using google" using
>> the documentation here:
>> https://developers.google.com/accounts/docs/OAuth2
>>
>> However, a problem arises when the callback url is like this:
>> 
http://localhost:5000/oauth2callback#access_token={token}&token_type=Bearer&expires_in=3600
>>
>> That is, instead of '?', they are using '#' to separate the parameters.
>> Flask does not require this as GET parameters.
>>
>> How to handle this?
>>
>>  Thanks,
>> Regards,
>> Sherjil Ozair
>>
>
>

Re: [flask] URLs with #

From:
Shriram Kunchanapalli
Date:
2012-07-23 @ 01:47
Strange that you get it even after using Rest API
Can you use request.url and just parse it ?

On Monday, July 23, 2012, Sherjil Ozair wrote:

> Hi Xuanyi,
>
> No, I'm not using the # anywhere. The Google API is sending back results
> using #. I think, they only mean this to be in javascript.
>
> Is there any other easy way to put a simple 'login using google' button on
> my website. I can't seem to find anything easy.
>
> Sherjil Ozair
>
> On Mon, Jul 23, 2012 at 3:45 AM, Xuanyi Chew 
<chewxy@gmail.com<javascript:_e({}, 'cvml', 'chewxy@gmail.com');>
> > wrote:
>
>> # represents anchors - specifically named anchors in HTML. In this case,
>> you'd need javascript to intercept your named anchors, but it shouldn't be
>> the case since it's a callback, and you provided the callback redirect uri
>> to the oauth to begin with.
>>
>> If I were you, I'd check your own code to see if you're using # instead
>> of ?
>>
>>
>> Xuanyi Chew
>> Co-founder, edgeyo
>> +61403928398
>>
>> edgeyo is an active matching platform for investors and entrepreneurs.
>> Lean startups, meet lean funding. Find out more at http://edgeyo.com
>>
>>
>>
>> On Mon, Jul 23, 2012 at 8:06 AM, Sherjil Ozair 
<sherjilozair@gmail.com<javascript:_e({}, 'cvml', 
'sherjilozair@gmail.com');>
>> > wrote:
>>
>>> Hello list,
>>>
>>> I'm new to flask and am trying to integrate "login using google" using
>>> the documentation here:
>>> https://developers.google.com/accounts/docs/OAuth2
>>>
>>> However, a problem arises when the callback url is like this:
>>> 
http://localhost:5000/oauth2callback#access_token={token}&token_type=Bearer&expires_in=3600
>>>
>>> That is, instead of '?', they are using '#' to separate the parameters.
>>> Flask does not require this as GET parameters.
>>>
>>> How to handle this?
>>>
>>>  Thanks,
>>> Regards,
>>> Sherjil Ozair
>>>
>>
>>
>

Re: [flask] URLs with #

From:
Sherjil Ozair
Date:
2012-07-23 @ 04:14
Hey guys,

Thanks for all the suggestions.

@Kenneth, your repo is not in the flask extensions registry?

@Shriram, No. request.url only has part of the url before the #. I think
its a design decision, since # is supposed to be handled by the browser,
and ? by the server. I may be wrong.

I'm sure it is possible for flask to add the full url to the request
object. I don't know why they chose to not include it.

Sherjil Ozair

On Mon, Jul 23, 2012 at 7:17 AM, Shriram Kunchanapalli <kshriram18@gmail.com
> wrote:

> Strange that you get it even after using Rest API
> Can you use request.url and just parse it ?
>
>
> On Monday, July 23, 2012, Sherjil Ozair wrote:
>
>> Hi Xuanyi,
>>
>> No, I'm not using the # anywhere. The Google API is sending back results
>> using #. I think, they only mean this to be in javascript.
>>
>> Is there any other easy way to put a simple 'login using google' button
>> on my website. I can't seem to find anything easy.
>>
>> Sherjil Ozair
>>
>> On Mon, Jul 23, 2012 at 3:45 AM, Xuanyi Chew <chewxy@gmail.com> wrote:
>>
>>> # represents anchors - specifically named anchors in HTML. In this case,
>>> you'd need javascript to intercept your named anchors, but it shouldn't be
>>> the case since it's a callback, and you provided the callback redirect uri
>>> to the oauth to begin with.
>>>
>>> If I were you, I'd check your own code to see if you're using # instead
>>> of ?
>>>
>>>
>>> Xuanyi Chew
>>> Co-founder, edgeyo
>>> +61403928398
>>>
>>> edgeyo is an active matching platform for investors and entrepreneurs.
>>> Lean startups, meet lean funding. Find out more at http://edgeyo.com
>>>
>>>
>>>
>>> On Mon, Jul 23, 2012 at 8:06 AM, Sherjil Ozair <sherjilozair@gmail.com>wrote:
>>>
>>>> Hello list,
>>>>
>>>> I'm new to flask and am trying to integrate "login using google" using
>>>> the documentation here:
>>>> https://developers.google.com/accounts/docs/OAuth2
>>>>
>>>> However, a problem arises when the callback url is like this:
>>>> 
http://localhost:5000/oauth2callback#access_token={token}&token_type=Bearer&expires_in=3600
>>>>
>>>> That is, instead of '?', they are using '#' to separate the parameters.
>>>> Flask does not require this as GET parameters.
>>>>
>>>> How to handle this?
>>>>
>>>>  Thanks,
>>>> Regards,
>>>> Sherjil Ozair
>>>>
>>>
>>>
>>

Re: [flask] URLs with #

From:
Simon Sapin
Date:
2012-07-23 @ 05:55
Le 23/07/2012 06:14, Sherjil Ozair a écrit :
>
> @Shriram, No. request.url only has part of the url before the #. I think
> its a design decision, since # is supposed to be handled by the browser,
> and ? by the server. I may be wrong.
>
> I'm sure it is possible for flask to add the full url to the request
> object. I don't know why they chose to not include it.

Hi,

When you type this URL in your browser:
http://example.net/path?query#fragment

The request that is sent to the server looks like this:

GET /path?query HTTP/1.1
Host: example.net

Flask glues these parts back together and request.url is 
http://example.net/path?query
Flask can not give you the fragment because it does not have it.

Only later, if the response is HTML, the browser looks for an element 
with id="fragment" and scrolls it into view.

I don’t know how Google auth is supposed to work, but I can only assume 
the fragment is supposed to be accessed with JavaScript on the client side.

-- 
Simon Sapin

Re: [flask] URLs with #

From:
Shriram Kunchanapalli
Date:
2012-07-23 @ 09:42
Thanks for that Simon. It helped me understand  :)

@Sherjil
I came across

http://stackoverflow.com/questions/10704817/asp-net-google-oauth2-returning-token-after-hash-instead-of-in-a-querystring
 and it has js code that handles it is at
https://developers.google.com/accounts/docs/OAuth2UserAgent


On Monday, July 23, 2012, Simon Sapin wrote:

> Le 23/07/2012 06:14, Sherjil Ozair a écrit :
> >
> > @Shriram, No. request.url only has part of the url before the #. I think
> > its a design decision, since # is supposed to be handled by the browser,
> > and ? by the server. I may be wrong.
> >
> > I'm sure it is possible for flask to add the full url to the request
> > object. I don't know why they chose to not include it.
>
> Hi,
>
> When you type this URL in your browser:
> http://example.net/path?query#fragment
>
> The request that is sent to the server looks like this:
>
> GET /path?query HTTP/1.1
> Host: example.net
>
> Flask glues these parts back together and request.url is
> http://example.net/path?query
> Flask can not give you the fragment because it does not have it.
>
> Only later, if the response is HTML, the browser looks for an element
> with id="fragment" and scrolls it into view.
>
> I don’t know how Google auth is supposed to work, but I can only assume
> the fragment is supposed to be accessed with JavaScript on the client side.
>
> --
> Simon Sapin
>

Re: [flask] URLs with #

From:
pronoyc@gmail.com
Date:
2012-07-23 @ 01:34
Login using Google. Isn't that part of Open-ID? There is an extension for
that.

On Mon, Jul 23, 2012 at 3:56 AM, Sherjil Ozair <sherjilozair@gmail.com>wrote:

> Hi Xuanyi,
>
> No, I'm not using the # anywhere. The Google API is sending back results
> using #. I think, they only mean this to be in javascript.
>
> Is there any other easy way to put a simple 'login using google' button on
> my website. I can't seem to find anything easy.
>
> Sherjil Ozair
>
> On Mon, Jul 23, 2012 at 3:45 AM, Xuanyi Chew <chewxy@gmail.com> wrote:
>
>> # represents anchors - specifically named anchors in HTML. In this case,
>> you'd need javascript to intercept your named anchors, but it shouldn't be
>> the case since it's a callback, and you provided the callback redirect uri
>> to the oauth to begin with.
>>
>> If I were you, I'd check your own code to see if you're using # instead
>> of ?
>>
>>
>> Xuanyi Chew
>> Co-founder, edgeyo
>> +61403928398
>>
>> edgeyo is an active matching platform for investors and entrepreneurs.
>> Lean startups, meet lean funding. Find out more at http://edgeyo.com
>>
>>
>>
>> On Mon, Jul 23, 2012 at 8:06 AM, Sherjil Ozair <sherjilozair@gmail.com>wrote:
>>
>>> Hello list,
>>>
>>> I'm new to flask and am trying to integrate "login using google" using
>>> the documentation here:
>>> https://developers.google.com/accounts/docs/OAuth2
>>>
>>> However, a problem arises when the callback url is like this:
>>> 
http://localhost:5000/oauth2callback#access_token={token}&token_type=Bearer&expires_in=3600
>>>
>>> That is, instead of '?', they are using '#' to separate the parameters.
>>> Flask does not require this as GET parameters.
>>>
>>> How to handle this?
>>>
>>>  Thanks,
>>> Regards,
>>> Sherjil Ozair
>>>
>>
>>
>


-- 
Regards,

Pronoy Chopra
http://blog.pronoy.in <http://www.pronoy.in/about>/
http://www.twitter.com/pronoyc

Re: [flask] URLs with #

From:
Kenneth Reitz
Date:
2012-07-23 @ 01:36
I wrote a super simple extension just for Google Auth: 

https://github.com/kennethreitz/flask-googlefed 

-- 
Kenneth Reitz


On Sunday, July 22, 2012 at 9:34 PM, pronoyc@gmail.com wrote:

> Login using Google. Isn't that part of Open-ID? There is an extension for that.
> 
> On Mon, Jul 23, 2012 at 3:56 AM, Sherjil Ozair <sherjilozair@gmail.com 
(mailto:sherjilozair@gmail.com)> wrote:
> > Hi Xuanyi,
> > 
> > No, I'm not using the # anywhere. The Google API is sending back 
results using #. I think, they only mean this to be in javascript. 
> > 
> > Is there any other easy way to put a simple 'login using google' 
button on my website. I can't seem to find anything easy. 
> > 
> > Sherjil Ozair
> > 
> > On Mon, Jul 23, 2012 at 3:45 AM, Xuanyi Chew <chewxy@gmail.com 
(mailto:chewxy@gmail.com)> wrote:
> > > # represents anchors - specifically named anchors in HTML. In this 
case, you'd need javascript to intercept your named anchors, but it 
shouldn't be the case since it's a callback, and you provided the callback
redirect uri to the oauth to begin with.
> > > 
> > > If I were you, I'd check your own code to see if you're using # 
instead of ? 
> > > 
> > > 
> > > Xuanyi Chew
> > > Co-founder, edgeyo
> > > +61403928398 (tel:%2B61403928398)
> > > 
> > > edgeyo is an active matching platform for investors and 
entrepreneurs. Lean startups, meet lean funding. Find out more at 
http://edgeyo.com
> > > 
> > > 
> > > 
> > > On Mon, Jul 23, 2012 at 8:06 AM, Sherjil Ozair 
<sherjilozair@gmail.com (mailto:sherjilozair@gmail.com)> wrote:
> > > > Hello list,
> > > > 
> > > > I'm new to flask and am trying to integrate "login using google" 
using the documentation here: 
https://developers.google.com/accounts/docs/OAuth2 
> > > > 
> > > > However, a problem arises when the callback url is like this: 
http://localhost:5000/oauth2callback#access_token={token}&token_type=Bearer&expires_in=3600

(http://localhost:5000/oauth2callback#access_token=%7Btoken%7D&token_type=Bearer&expires_in=3600)

> > > > 
> > > > That is, instead of '?', they are using '#' to separate the 
parameters. Flask does not require this as GET parameters.
> > > > 
> > > > How to handle this?
> > > > 
> > > > Thanks,
> > > > Regards,
> > > > Sherjil Ozair
> > > > 
> > > 
> > > 
> > > 
> > 
> 
> 
> 
> -- 
> Regards,
> 
> Pronoy Chopra
> http://blog.pronoy.in (http://www.pronoy.in/about)/
> http://www.twitter.com/pronoyc
> 

Re: [flask] URLs with #

From:
Sean Lynch
Date:
2012-07-23 @ 01:40
Might also want to check out Flask-Social. I added the Google+ oauth
provider for logins. Its still under active development and more than
likely have breaking changes between versions.
On Jul 22, 2012 6:28 PM, "Sherjil Ozair" <sherjilozair@gmail.com> wrote:

> Hi Xuanyi,
>
> No, I'm not using the # anywhere. The Google API is sending back results
> using #. I think, they only mean this to be in javascript.
>
> Is there any other easy way to put a simple 'login using google' button on
> my website. I can't seem to find anything easy.
>
> Sherjil Ozair
>
> On Mon, Jul 23, 2012 at 3:45 AM, Xuanyi Chew <chewxy@gmail.com> wrote:
>
>> # represents anchors - specifically named anchors in HTML. In this case,
>> you'd need javascript to intercept your named anchors, but it shouldn't be
>> the case since it's a callback, and you provided the callback redirect uri
>> to the oauth to begin with.
>>
>> If I were you, I'd check your own code to see if you're using # instead
>> of ?
>>
>>
>> Xuanyi Chew
>> Co-founder, edgeyo
>> +61403928398
>>
>> edgeyo is an active matching platform for investors and entrepreneurs.
>> Lean startups, meet lean funding. Find out more at http://edgeyo.com
>>
>>
>>
>> On Mon, Jul 23, 2012 at 8:06 AM, Sherjil Ozair <sherjilozair@gmail.com>wrote:
>>
>>> Hello list,
>>>
>>> I'm new to flask and am trying to integrate "login using google" using
>>> the documentation here:
>>> https://developers.google.com/accounts/docs/OAuth2
>>>
>>> However, a problem arises when the callback url is like this:
>>> 
http://localhost:5000/oauth2callback#access_token={token}&token_type=Bearer&expires_in=3600
>>>
>>> That is, instead of '?', they are using '#' to separate the parameters.
>>> Flask does not require this as GET parameters.
>>>
>>> How to handle this?
>>>
>>>  Thanks,
>>> Regards,
>>> Sherjil Ozair
>>>
>>
>>
>

Re: [flask] URLs with #

From:
Sherjil Ozair
Date:
2012-07-23 @ 05:01
Hi Sean,

The documentation for Flask-Social does not mention Google+, unfortunately.
Is it very similar to how Facebook and Twitter is done? Still, some example
code would be helpful.

Thanks,
Sherjil Ozair

On Mon, Jul 23, 2012 at 7:10 AM, Sean Lynch <techniq35@gmail.com> wrote:

> Might also want to check out Flask-Social. I added the Google+ oauth
> provider for logins. Its still under active development and more than
> likely have breaking changes between versions.
> On Jul 22, 2012 6:28 PM, "Sherjil Ozair" <sherjilozair@gmail.com> wrote:
>
>> Hi Xuanyi,
>>
>> No, I'm not using the # anywhere. The Google API is sending back results
>> using #. I think, they only mean this to be in javascript.
>>
>> Is there any other easy way to put a simple 'login using google' button
>> on my website. I can't seem to find anything easy.
>>
>> Sherjil Ozair
>>
>> On Mon, Jul 23, 2012 at 3:45 AM, Xuanyi Chew <chewxy@gmail.com> wrote:
>>
>>> # represents anchors - specifically named anchors in HTML. In this case,
>>> you'd need javascript to intercept your named anchors, but it shouldn't be
>>> the case since it's a callback, and you provided the callback redirect uri
>>> to the oauth to begin with.
>>>
>>> If I were you, I'd check your own code to see if you're using # instead
>>> of ?
>>>
>>>
>>> Xuanyi Chew
>>> Co-founder, edgeyo
>>> +61403928398
>>>
>>> edgeyo is an active matching platform for investors and entrepreneurs.
>>> Lean startups, meet lean funding. Find out more at http://edgeyo.com
>>>
>>>
>>>
>>> On Mon, Jul 23, 2012 at 8:06 AM, Sherjil Ozair <sherjilozair@gmail.com>wrote:
>>>
>>>> Hello list,
>>>>
>>>> I'm new to flask and am trying to integrate "login using google" using
>>>> the documentation here:
>>>> https://developers.google.com/accounts/docs/OAuth2
>>>>
>>>> However, a problem arises when the callback url is like this:
>>>> 
http://localhost:5000/oauth2callback#access_token={token}&token_type=Bearer&expires_in=3600
>>>>
>>>> That is, instead of '?', they are using '#' to separate the parameters.
>>>> Flask does not require this as GET parameters.
>>>>
>>>> How to handle this?
>>>>
>>>>  Thanks,
>>>> Regards,
>>>> Sherjil Ozair
>>>>
>>>
>>>
>>

Re: [flask] URLs with #

From:
Anthony Ford
Date:
2012-07-23 @ 05:41
Would it be possible to use Open-ID for your task? If so, flask-openID is
available in the flask extensions. And if you want to see  an example, you
can check out  http://github.com/arcc/caratracker

Hope that helps.

Anthony Ford,
ford.anthonyj@gmail.com,
Research Assistant,
Center for Advanced Radio Astronomy,
University of Texas - Brownsville
On Jul 23, 2012 12:02 AM, "Sherjil Ozair" <sherjilozair@gmail.com> wrote:

> Hi Sean,
>
> The documentation for Flask-Social does not mention Google+, unfortunately.
> Is it very similar to how Facebook and Twitter is done? Still, some
> example code would be helpful.
>
> Thanks,
> Sherjil Ozair
>
> On Mon, Jul 23, 2012 at 7:10 AM, Sean Lynch <techniq35@gmail.com> wrote:
>
>> Might also want to check out Flask-Social. I added the Google+ oauth
>> provider for logins. Its still under active development and more than
>> likely have breaking changes between versions.
>>  On Jul 22, 2012 6:28 PM, "Sherjil Ozair" <sherjilozair@gmail.com> wrote:
>>
>>> Hi Xuanyi,
>>>
>>> No, I'm not using the # anywhere. The Google API is sending back results
>>> using #. I think, they only mean this to be in javascript.
>>>
>>> Is there any other easy way to put a simple 'login using google' button
>>> on my website. I can't seem to find anything easy.
>>>
>>> Sherjil Ozair
>>>
>>> On Mon, Jul 23, 2012 at 3:45 AM, Xuanyi Chew <chewxy@gmail.com> wrote:
>>>
>>>> # represents anchors - specifically named anchors in HTML. In this
>>>> case, you'd need javascript to intercept your named anchors, but it
>>>> shouldn't be the case since it's a callback, and you provided the callback
>>>> redirect uri to the oauth to begin with.
>>>>
>>>> If I were you, I'd check your own code to see if you're using # instead
>>>> of ?
>>>>
>>>>
>>>> Xuanyi Chew
>>>> Co-founder, edgeyo
>>>> +61403928398
>>>>
>>>> edgeyo is an active matching platform for investors and entrepreneurs.
>>>> Lean startups, meet lean funding. Find out more at http://edgeyo.com
>>>>
>>>>
>>>>
>>>> On Mon, Jul 23, 2012 at 8:06 AM, Sherjil Ozair <sherjilozair@gmail.com>wrote:
>>>>
>>>>> Hello list,
>>>>>
>>>>> I'm new to flask and am trying to integrate "login using google" using
>>>>> the documentation here:
>>>>> https://developers.google.com/accounts/docs/OAuth2
>>>>>
>>>>> However, a problem arises when the callback url is like this:
>>>>> 
http://localhost:5000/oauth2callback#access_token={token}&token_type=Bearer&expires_in=3600
>>>>>
>>>>> That is, instead of '?', they are using '#' to separate the
>>>>> parameters. Flask does not require this as GET parameters.
>>>>>
>>>>> How to handle this?
>>>>>
>>>>>  Thanks,
>>>>> Regards,
>>>>> Sherjil Ozair
>>>>>
>>>>
>>>>
>>>
>

Re: [flask] URLs with #

From:
Sean Lynch
Date:
2012-07-23 @ 13:27
Sherjil - Yes, just like Facebook.  You'll need to provide a consumer key
and consumer secret, as well as any scope (apis to access).

    SOCIAL_GOOGLE = {
>         'oauth': {
>             'consumer_key': 'YOUR_KEY',
>             'consumer_secret': 'YOU_SECRET',
>             'request_token_params': {
>                 'scope': 'https://www.googleapis.com/auth/userinfo.email',
>                 'response_type': 'code'
>             }
>         }
>     }


Currently it just works with Google+, but I plan to adjust how the api is
setup to allow for any of the OAuth endpoints (drive, gmail, etc).  To
access the Google+ api, here is an example

from flask import current_app
> connection = current_app.social.google.get_connection()
> connection.api.some_api_method()


The docs also need to be updated with better examples.

On Mon, Jul 23, 2012 at 1:01 AM, Sherjil Ozair <sherjilozair@gmail.com>wrote:

> Hi Sean,
>
> The documentation for Flask-Social does not mention Google+, unfortunately.
> Is it very similar to how Facebook and Twitter is done? Still, some
> example code would be helpful.
>
> Thanks,
> Sherjil Ozair
>
>
> On Mon, Jul 23, 2012 at 7:10 AM, Sean Lynch <techniq35@gmail.com> wrote:
>
>> Might also want to check out Flask-Social. I added the Google+ oauth
>> provider for logins. Its still under active development and more than
>> likely have breaking changes between versions.
>>  On Jul 22, 2012 6:28 PM, "Sherjil Ozair" <sherjilozair@gmail.com> wrote:
>>
>>> Hi Xuanyi,
>>>
>>> No, I'm not using the # anywhere. The Google API is sending back results
>>> using #. I think, they only mean this to be in javascript.
>>>
>>> Is there any other easy way to put a simple 'login using google' button
>>> on my website. I can't seem to find anything easy.
>>>
>>> Sherjil Ozair
>>>
>>> On Mon, Jul 23, 2012 at 3:45 AM, Xuanyi Chew <chewxy@gmail.com> wrote:
>>>
>>>> # represents anchors - specifically named anchors in HTML. In this
>>>> case, you'd need javascript to intercept your named anchors, but it
>>>> shouldn't be the case since it's a callback, and you provided the callback
>>>> redirect uri to the oauth to begin with.
>>>>
>>>> If I were you, I'd check your own code to see if you're using # instead
>>>> of ?
>>>>
>>>>
>>>> Xuanyi Chew
>>>> Co-founder, edgeyo
>>>> +61403928398
>>>>
>>>> edgeyo is an active matching platform for investors and entrepreneurs.
>>>> Lean startups, meet lean funding. Find out more at http://edgeyo.com
>>>>
>>>>
>>>>
>>>> On Mon, Jul 23, 2012 at 8:06 AM, Sherjil Ozair <sherjilozair@gmail.com>wrote:
>>>>
>>>>> Hello list,
>>>>>
>>>>> I'm new to flask and am trying to integrate "login using google" using
>>>>> the documentation here:
>>>>> https://developers.google.com/accounts/docs/OAuth2
>>>>>
>>>>> However, a problem arises when the callback url is like this:
>>>>> 
http://localhost:5000/oauth2callback#access_token={token}&token_type=Bearer&expires_in=3600
>>>>>
>>>>> That is, instead of '?', they are using '#' to separate the
>>>>> parameters. Flask does not require this as GET parameters.
>>>>>
>>>>> How to handle this?
>>>>>
>>>>>  Thanks,
>>>>> Regards,
>>>>> Sherjil Ozair
>>>>>
>>>>
>>>>
>>>
>

Re: [flask] URLs with #

From:
Sherjil Ozair
Date:
2012-07-24 @ 08:03
Do you mean the client ID by YOUR_KEY ?

On Mon, Jul 23, 2012 at 6:57 PM, Sean Lynch <techniq35@gmail.com> wrote:

> Sherjil - Yes, just like Facebook.  You'll need to provide a consumer key
> and consumer secret, as well as any scope (apis to access).
>
>     SOCIAL_GOOGLE = {
>>         'oauth': {
>>             'consumer_key': 'YOUR_KEY',
>>             'consumer_secret': 'YOU_SECRET',
>>             'request_token_params': {
>>                 'scope': 'https://www.googleapis.com/auth/userinfo.email
>> ',
>>                 'response_type': 'code'
>>             }
>>         }
>>     }
>
>
> Currently it just works with Google+, but I plan to adjust how the api is
> setup to allow for any of the OAuth endpoints (drive, gmail, etc).  To
> access the Google+ api, here is an example
>
> from flask import current_app
>> connection = current_app.social.google.get_connection()
>> connection.api.some_api_method()
>
>
> The docs also need to be updated with better examples.
>
> On Mon, Jul 23, 2012 at 1:01 AM, Sherjil Ozair <sherjilozair@gmail.com>wrote:
>
>> Hi Sean,
>>
>> The documentation for Flask-Social does not mention Google+,
>> unfortunately.
>> Is it very similar to how Facebook and Twitter is done? Still, some
>> example code would be helpful.
>>
>> Thanks,
>> Sherjil Ozair
>>
>>
>> On Mon, Jul 23, 2012 at 7:10 AM, Sean Lynch <techniq35@gmail.com> wrote:
>>
>>> Might also want to check out Flask-Social. I added the Google+ oauth
>>> provider for logins. Its still under active development and more than
>>> likely have breaking changes between versions.
>>>  On Jul 22, 2012 6:28 PM, "Sherjil Ozair" <sherjilozair@gmail.com>
>>> wrote:
>>>
>>>> Hi Xuanyi,
>>>>
>>>> No, I'm not using the # anywhere. The Google API is sending back
>>>> results using #. I think, they only mean this to be in javascript.
>>>>
>>>> Is there any other easy way to put a simple 'login using google' button
>>>> on my website. I can't seem to find anything easy.
>>>>
>>>> Sherjil Ozair
>>>>
>>>> On Mon, Jul 23, 2012 at 3:45 AM, Xuanyi Chew <chewxy@gmail.com> wrote:
>>>>
>>>>> # represents anchors - specifically named anchors in HTML. In this
>>>>> case, you'd need javascript to intercept your named anchors, but it
>>>>> shouldn't be the case since it's a callback, and you provided the callback
>>>>> redirect uri to the oauth to begin with.
>>>>>
>>>>> If I were you, I'd check your own code to see if you're using #
>>>>> instead of ?
>>>>>
>>>>>
>>>>> Xuanyi Chew
>>>>> Co-founder, edgeyo
>>>>> +61403928398
>>>>>
>>>>> edgeyo is an active matching platform for investors and entrepreneurs.
>>>>> Lean startups, meet lean funding. Find out more at http://edgeyo.com
>>>>>
>>>>>
>>>>>
>>>>> On Mon, Jul 23, 2012 at 8:06 AM, Sherjil Ozair <sherjilozair@gmail.com
>>>>> > wrote:
>>>>>
>>>>>> Hello list,
>>>>>>
>>>>>> I'm new to flask and am trying to integrate "login using google"
>>>>>> using the documentation here:
>>>>>> https://developers.google.com/accounts/docs/OAuth2
>>>>>>
>>>>>> However, a problem arises when the callback url is like this:
>>>>>> 
http://localhost:5000/oauth2callback#access_token={token}&token_type=Bearer&expires_in=3600
>>>>>>
>>>>>> That is, instead of '?', they are using '#' to separate the
>>>>>> parameters. Flask does not require this as GET parameters.
>>>>>>
>>>>>> How to handle this?
>>>>>>
>>>>>>  Thanks,
>>>>>> Regards,
>>>>>> Sherjil Ozair
>>>>>>
>>>>>
>>>>>
>>>>
>>
>

Re: [flask] URLs with #

From:
Sean Lynch
Date:
2012-07-24 @ 14:18
@Sherjil: Yes, client ID is YOUR_KEY.  Also, I believe you need the current
HEAD of Flask-OAuth (the not yet released 0.12) which you can install via
pip using:

pip install https://github.com/mitsuhiko/flask-oauth/zipball/master

You'll also need the latest from github for Flask-Security and Flask-Social
(develop branches) as I don't believe the Google provider has been included
in a release yet.  I currently have my own forks added to a
requirements.txt file that I install from (pip -r requirements.txt).
 Flask-Social might be too WIP if all your needing is login (no api
access).  If that's the case, I would lean towards Kenneth's
Flask-Googlefed (OpenID).

I haven't talked with primary auth of Flask-Security / Social lately, but
hopefully there will be a release for it soon (might be waiting on the next
Flask-OAuth to get released as well).

On Tue, Jul 24, 2012 at 4:03 AM, Sherjil Ozair <sherjilozair@gmail.com>wrote:

> Do you mean the client ID by YOUR_KEY ?
>
>
> On Mon, Jul 23, 2012 at 6:57 PM, Sean Lynch <techniq35@gmail.com> wrote:
>
>> Sherjil - Yes, just like Facebook.  You'll need to provide a consumer key
>> and consumer secret, as well as any scope (apis to access).
>>
>>     SOCIAL_GOOGLE = {
>>>         'oauth': {
>>>             'consumer_key': 'YOUR_KEY',
>>>             'consumer_secret': 'YOU_SECRET',
>>>             'request_token_params': {
>>>                 'scope': 'https://www.googleapis.com/auth/userinfo.email
>>> ',
>>>                 'response_type': 'code'
>>>             }
>>>         }
>>>     }
>>
>>
>> Currently it just works with Google+, but I plan to adjust how the api is
>> setup to allow for any of the OAuth endpoints (drive, gmail, etc).  To
>> access the Google+ api, here is an example
>>
>> from flask import current_app
>>> connection = current_app.social.google.get_connection()
>>> connection.api.some_api_method()
>>
>>
>> The docs also need to be updated with better examples.
>>
>> On Mon, Jul 23, 2012 at 1:01 AM, Sherjil Ozair <sherjilozair@gmail.com>wrote:
>>
>>> Hi Sean,
>>>
>>> The documentation for Flask-Social does not mention Google+,
>>> unfortunately.
>>> Is it very similar to how Facebook and Twitter is done? Still, some
>>> example code would be helpful.
>>>
>>> Thanks,
>>> Sherjil Ozair
>>>
>>>
>>> On Mon, Jul 23, 2012 at 7:10 AM, Sean Lynch <techniq35@gmail.com> wrote:
>>>
>>>> Might also want to check out Flask-Social. I added the Google+ oauth
>>>> provider for logins. Its still under active development and more than
>>>> likely have breaking changes between versions.
>>>>  On Jul 22, 2012 6:28 PM, "Sherjil Ozair" <sherjilozair@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi Xuanyi,
>>>>>
>>>>> No, I'm not using the # anywhere. The Google API is sending back
>>>>> results using #. I think, they only mean this to be in javascript.
>>>>>
>>>>> Is there any other easy way to put a simple 'login using google'
>>>>> button on my website. I can't seem to find anything easy.
>>>>>
>>>>> Sherjil Ozair
>>>>>
>>>>> On Mon, Jul 23, 2012 at 3:45 AM, Xuanyi Chew <chewxy@gmail.com> wrote:
>>>>>
>>>>>> # represents anchors - specifically named anchors in HTML. In this
>>>>>> case, you'd need javascript to intercept your named anchors, but it
>>>>>> shouldn't be the case since it's a callback, and you provided the callback
>>>>>> redirect uri to the oauth to begin with.
>>>>>>
>>>>>> If I were you, I'd check your own code to see if you're using #
>>>>>> instead of ?
>>>>>>
>>>>>>
>>>>>> Xuanyi Chew
>>>>>> Co-founder, edgeyo
>>>>>> +61403928398
>>>>>>
>>>>>> edgeyo is an active matching platform for investors and
>>>>>> entrepreneurs. Lean startups, meet lean funding. Find out more at
>>>>>> http://edgeyo.com
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Mon, Jul 23, 2012 at 8:06 AM, Sherjil Ozair <
>>>>>> sherjilozair@gmail.com> wrote:
>>>>>>
>>>>>>> Hello list,
>>>>>>>
>>>>>>> I'm new to flask and am trying to integrate "login using google"
>>>>>>> using the documentation here:
>>>>>>> https://developers.google.com/accounts/docs/OAuth2
>>>>>>>
>>>>>>> However, a problem arises when the callback url is like this:
>>>>>>> 
http://localhost:5000/oauth2callback#access_token={token}&token_type=Bearer&expires_in=3600
>>>>>>>
>>>>>>> That is, instead of '?', they are using '#' to separate the
>>>>>>> parameters. Flask does not require this as GET parameters.
>>>>>>>
>>>>>>> How to handle this?
>>>>>>>
>>>>>>>  Thanks,
>>>>>>> Regards,
>>>>>>> Sherjil Ozair
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>
>>
>

Re: [flask] URLs with #

From:
vivek poddar
Date:
2012-07-31 @ 03:50
Hi Everyone!

I was reading this discussion and hope that anyone who has implemented this
should give the brief documentation about all the steps. Hope this will
help in future for the developers like us.

    And @Sherjil pls. help the community if you get success.

Thanks and regards!

On Tue, Jul 24, 2012 at 7:48 PM, Sean Lynch <techniq35@gmail.com> wrote:

> @Sherjil: Yes, client ID is YOUR_KEY.  Also, I believe you need the
> current HEAD of Flask-OAuth (the not yet released 0.12) which you can
> install via pip using:
>
> pip install https://github.com/mitsuhiko/flask-oauth/zipball/master
>
> You'll also need the latest from github for Flask-Security and
> Flask-Social (develop branches) as I don't believe the Google provider has
> been included in a release yet.  I currently have my own forks added to a
> requirements.txt file that I install from (pip -r requirements.txt).
>  Flask-Social might be too WIP if all your needing is login (no api
> access).  If that's the case, I would lean towards Kenneth's
> Flask-Googlefed (OpenID).
>
> I haven't talked with primary auth of Flask-Security / Social lately, but
> hopefully there will be a release for it soon (might be waiting on the next
> Flask-OAuth to get released as well).
>
> On Tue, Jul 24, 2012 at 4:03 AM, Sherjil Ozair <sherjilozair@gmail.com>wrote:
>
>> Do you mean the client ID by YOUR_KEY ?
>>
>>
>> On Mon, Jul 23, 2012 at 6:57 PM, Sean Lynch <techniq35@gmail.com> wrote:
>>
>>> Sherjil - Yes, just like Facebook.  You'll need to provide a consumer
>>> key and consumer secret, as well as any scope (apis to access).
>>>
>>>     SOCIAL_GOOGLE = {
>>>>         'oauth': {
>>>>             'consumer_key': 'YOUR_KEY',
>>>>             'consumer_secret': 'YOU_SECRET',
>>>>             'request_token_params': {
>>>>                 'scope': '
>>>> https://www.googleapis.com/auth/userinfo.email',
>>>>                 'response_type': 'code'
>>>>             }
>>>>         }
>>>>     }
>>>
>>>
>>> Currently it just works with Google+, but I plan to adjust how the api
>>> is setup to allow for any of the OAuth endpoints (drive, gmail, etc).  To
>>> access the Google+ api, here is an example
>>>
>>> from flask import current_app
>>>> connection = current_app.social.google.get_connection()
>>>> connection.api.some_api_method()
>>>
>>>
>>> The docs also need to be updated with better examples.
>>>
>>> On Mon, Jul 23, 2012 at 1:01 AM, Sherjil Ozair <sherjilozair@gmail.com>wrote:
>>>
>>>> Hi Sean,
>>>>
>>>> The documentation for Flask-Social does not mention Google+,
>>>> unfortunately.
>>>> Is it very similar to how Facebook and Twitter is done? Still, some
>>>> example code would be helpful.
>>>>
>>>> Thanks,
>>>> Sherjil Ozair
>>>>
>>>>
>>>> On Mon, Jul 23, 2012 at 7:10 AM, Sean Lynch <techniq35@gmail.com>wrote:
>>>>
>>>>> Might also want to check out Flask-Social. I added the Google+ oauth
>>>>> provider for logins. Its still under active development and more than
>>>>> likely have breaking changes between versions.
>>>>>  On Jul 22, 2012 6:28 PM, "Sherjil Ozair" <sherjilozair@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hi Xuanyi,
>>>>>>
>>>>>> No, I'm not using the # anywhere. The Google API is sending back
>>>>>> results using #. I think, they only mean this to be in javascript.
>>>>>>
>>>>>> Is there any other easy way to put a simple 'login using google'
>>>>>> button on my website. I can't seem to find anything easy.
>>>>>>
>>>>>> Sherjil Ozair
>>>>>>
>>>>>> On Mon, Jul 23, 2012 at 3:45 AM, Xuanyi Chew <chewxy@gmail.com>wrote:
>>>>>>
>>>>>>> # represents anchors - specifically named anchors in HTML. In this
>>>>>>> case, you'd need javascript to intercept your named anchors, but it
>>>>>>> shouldn't be the case since it's a callback, and you provided the callback
>>>>>>> redirect uri to the oauth to begin with.
>>>>>>>
>>>>>>> If I were you, I'd check your own code to see if you're using #
>>>>>>> instead of ?
>>>>>>>
>>>>>>>
>>>>>>> Xuanyi Chew
>>>>>>> Co-founder, edgeyo
>>>>>>> +61403928398
>>>>>>>
>>>>>>> edgeyo is an active matching platform for investors and
>>>>>>> entrepreneurs. Lean startups, meet lean funding. Find out more at
>>>>>>> http://edgeyo.com
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Jul 23, 2012 at 8:06 AM, Sherjil Ozair <
>>>>>>> sherjilozair@gmail.com> wrote:
>>>>>>>
>>>>>>>> Hello list,
>>>>>>>>
>>>>>>>> I'm new to flask and am trying to integrate "login using google"
>>>>>>>> using the documentation here:
>>>>>>>> https://developers.google.com/accounts/docs/OAuth2
>>>>>>>>
>>>>>>>> However, a problem arises when the callback url is like this:
>>>>>>>> 
http://localhost:5000/oauth2callback#access_token={token}&token_type=Bearer&expires_in=3600
>>>>>>>>
>>>>>>>> That is, instead of '?', they are using '#' to separate the
>>>>>>>> parameters. Flask does not require this as GET parameters.
>>>>>>>>
>>>>>>>> How to handle this?
>>>>>>>>
>>>>>>>>  Thanks,
>>>>>>>> Regards,
>>>>>>>> Sherjil Ozair
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>
>>>
>>
>


-- 

         -*- *Vivek Poddar* -*-

 *Technical consultant (OpenERP)*

*Blog:http://vivekimsit.blogspot.in/
*