1

So I am testing a Facebook authentication in my app and once I log into Facebook it redirects to my URL like this "http://localhost:4200/facebook-auth#access_token=MYACCESSTOKEN"

I try and access the parameter but it returns null.

const accessToken: string = this.route.snapshot.queryParamMap.get('access_token');

In testing if i change the URL to use a "?" instead of a "#" it works. But i don't have control of the redirect from Facebook. Not sure why I can't access it when it uses a "#"?

1
  • in mine app I use this this.route.queryParams.subscribe and it works fine. Commented Jan 7, 2019 at 7:50

1 Answer 1

2

I figured it out it is considered a fragment not a query param.

this.route.snapshot.fragment;

Sign up to request clarification or add additional context in comments.

Comments

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.