-1

Right now, I'm just doing the following for my Auth0 login -

if (location.hash) {
  // do something
}

How can I make sure it will only do this when it includes #access_token= ?

user1354934
  • 8,139
  • 15
  • 50
  • 80

1 Answers1

2

Use indexOf like so.

if(location.hash.indexOf("#access_token=" > -1) {
       // Do stuff
}

You can learn more on indexOf here.

Rando Hinn
  • 1,255
  • 19
  • 41