2
votes

I'm trying to authenticate users into an AgularJS app that uses routes based on hash (#) URLs.

So I'm calling

GET https://www.box.com/api/oauth2/authorize

with redirect_uri contaning an URL with a hash-based route, for example http://myapp.mydomain.com/#box.

Then after granting access, I am redirected to something like: http://myapp.mydomain.com/?code=CODE#/box .

The problem is that the hash part is after the query params, so it is not matching my route rule:

    state('box', {
      url: "/box?code",
      template: "<p>BOX</p>"
    })

How can I make this URL match my route?

1
Look at this oauth.io - Chandermani

1 Answers

1
votes

I've made it work by listening to $locationChangeStart event and then I "fix" the URL by putting the hash route before the query params.

This way, it matches my route with the code parameter correctly filled.