-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
  • 7,159
  • 13
  • 47
  • 67

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,212
  • 21
  • 39