seanmt13
seanmt13

Reputation: 422

Angular 6 Get Query Param with '#"

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 "#"?

Upvotes: 1

Views: 66

Answers (1)

seanmt13
seanmt13

Reputation: 422

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

this.route.snapshot.fragment;

Upvotes: 2

Related Questions