0

Checking param in URL, based on that param calling some other service. It's working as expected in Chrome/Mozilla/Edge but not in IE11. It's continuously redirecting to the same page.

http://localhost/oauth/?code=xxxxxx

and here are my component code.

ngOnInit() {
this.sub = this.route.queryParams.subscribe(params => {
  if (params['code']) {
    this.loginProcess = 'Hold tight! Authentication in progress.';
    this.authenticationService.getOADAccessToken(params['code']).subscribe(function(res){
       // some code
    });
  else {
    // redirect to login page
  }

It's getting param code value, after that even its calling getOADAccessToken service call. But before return from service call its falls to else part and again reloading the same page, getting param code and calling service and reloading.
service.ts

getOADAccessToken(token): Observable<any> {
    return this.http.post(environment.API + '/getAccessTokens',
        { code: token })
        .map((response: Response) => {
            const ADResult = response.json();
            return response.json();
        });
}

It's working in all browsers except IE10/11. Enabled all polyfills in polyfill.ts. Enabled Intl.
Here are the version details:
enter image description here

2
  • I'm using mobile so i'm not sure but your if statement lacks a closing brace } Commented Oct 27, 2017 at 6:31
  • @Adrian haha, have removed some other lines. '}' is there in original code Commented Oct 27, 2017 at 6:32

1 Answer 1

1

Are you using es6-shim? i have almost similar issues and i swithc to core.js instead of es6-shim. Below is sample to switch from es6-shim to core.js if you wanna gv it a try.

package.json

//replace es6-shim
    "core-js": "2.5.1",

html

<script src="https://cdnjs.cloudflare.com/ajax/libs/core-js/2.5.1/core.min.js"></script> 
Sign up to request clarification or add additional context in comments.

1 Comment

already package.json having "core-js": "^2.4.1" not using es6-shim.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.