0
 http://127.0.0.1:8084/Happy/studen/#access_token=eyJhbGciOiJIUzI1

I have a recirect url like this which redirects to a handler in my django app and it works fine .

The issue um facing was to read values appearing after # in the particular url . How may I read those values in the corresponding handler?

This is a pure Django Python Implementation and there wont be any javascripts to identify any urls

I cannot change the behavior of the token coming with the #

I Have tried both of these ways

  n = request.get_full_path()

  k = resolve(request.path_info).url_name

But it wont give me the values after # Is there a specific way to do this in django?

not 0x12
  • 19,360
  • 22
  • 67
  • 133
  • 1
    Possible duplicate of [How to identify an anchor in a url in Django?](http://stackoverflow.com/questions/14885023/how-to-identify-an-anchor-in-a-url-in-django) – TessellatingHeckler Sep 13 '16 at 03:47
  • @TessellatingHeckler This is a pure Django Python Implementation and there wont be any javascripts to identify any urls I cannot change the behavior of the token coming with the # – not 0x12 Sep 13 '16 at 03:50
  • 1
    Read the linked question's answers, there is no token coming with the # - it does not get sent to the server. Open Chrome, press F12 for the developer tools, go to the 'Network' tab, and watch as you visit something like `https://www.example.com/test?querystring=true#thisword` - the Request Headers include `test?querystring=true` and do not include `#thisword` – TessellatingHeckler Sep 13 '16 at 04:20
  • @TessellatingHeckler this comes from Fitbit API , i have no control over it , they are explicitly saying Note: When using the Authorization Code Grant Flow, Fitbit will also append #_=_ at the end of your redirect URI upon success https://dev.fitbit.com/docs/oauth2/ – not 0x12 Sep 13 '16 at 04:27
  • @Kalanamith They are not visible to Django. The browsers do not send those to the web server. You can only inspect them on the client side, using JS, for example. – Selcuk Sep 13 '16 at 04:51
  • 2
    Judging by [this introduction to Oauth2](https://aaronparecki.com/2012/07/29/2/oauth2-simplified), you are trying to use the [browser based app](https://aaronparecki.com/2012/07/29/2/oauth2-simplified#browser-based-apps) approach `#token=ACCESS_TOKEN - At this point, some Javascript code can pull out the access token`, but you need to be using the [web-server-apps](https://aaronparecki.com/2012/07/29/2/oauth2-simplified#web-server-apps) approach `the service redirects the user back to your site with an auth code [querystring] ?code=AUTH_CODE_HERE`. (no idea if the FitBit API supports this) – TessellatingHeckler Sep 13 '16 at 06:40
  • @TessellatingHeckler Thank you for your link , it was really helpful – not 0x12 Sep 13 '16 at 07:47

0 Answers0