2

I am writing an app using flask. I am using the RAuth module for OAuth. The url encoded access token that facebook is returning is formatted like www.myurl.com/authCallback#access_token=<token>.

I tried getting the raw string of the url using 'request.url', but that only returns www.myurl.com/authCallback

I also tried using a decoration of @app.route('/authCallback/<access_token>') which gives me a 404.

Is there a way to do this. Has anyone used these to libraries together before?

Charlie Andrews
  • 1,457
  • 19
  • 28
  • Try getting the raw url used in the request : http://werkzeug.pocoo.org/docs/wrappers/#werkzeug.wrappers.BaseRequest.path. Then parse it to extract the access token, and build a route. – michaelmeyer Jun 17 '13 at 21:37

2 Answers2

2

Take a look at Flask-rauth extension. May be it can give you some ideas ?

https://github.com/joelverhagen/flask-rauth

It has an examples section as well which includes facebook

https://github.com/joelverhagen/flask-rauth/blob/master/example/facebook.py

codegeek
  • 32,236
  • 12
  • 63
  • 63
2

Why not take a look at the Flask example? Here's the callback view that handles parsing the code out of the URL.

I would recommend following that example if you can. Hope that helps!

maxcountryman
  • 1,562
  • 1
  • 24
  • 51