Oidc-client-js: Issue getting id_token from url

Created on 4 Nov 2016  路  9Comments  路  Source: IdentityModel/oidc-client-js

It seems that when call the signinRedirectCallback my url is not being parsed correctly into a valid object.
My url is as follows: http://localhost:3000/#/id_token=.....

Therefore when the SigninResponse metho parses my url using the following line of code:

    var SigninResponse = function () {
        function SigninResponse(url) {
            _classCallCheck(this, SigninResponse);

            var values = _UrlUtility2.default.parseUrlFragment(url, "#");

            this.error = values.error;
            this.error_description = values.error_description;
            this.error_uri = values.error_uri;

it only removes the '#' and leaves the '/' resulting in the values variable having a /id_token property rather than an id_token property and then it throws an error because it can't find the id_token.

Any help?

question

Most helpful comment

i'd recommend not having the redirect uri back into the middle of angular routing. use a separate plain/simple page then once it's successful then redirect back int your NG app.

All 9 comments

What does your redirect_uri look like in config?

Is that a SPA page? If it's angular, then i have a feeling it's adding the "/" after the #.

yeah I am running angular 1.x

i'd recommend not having the redirect uri back into the middle of angular routing. use a separate plain/simple page then once it's successful then redirect back int your NG app.

Are there any other options in case we can't go that route?

you can parse the url yourself and pass it in as a param to the signinRedirectCallback API

Ok thanks for your help I will give that a try!

@jaredmahan you can try running your angular application in html5 mode (https://docs.angularjs.org/guide/$location) In that case the # is no longer used in your routes.
As far as I know only 1 # is allowed in your uri.

Was this page helpful?
0 / 5 - 0 ratings