0

my api url:

{{url}}/api/v1/users/updateHome?access_token={{access_token}}

I am trying to access the property access_token. I have tried the following ways to access it but it returns error:

  1. req.params('access_token'); //returns req.params is not a function
  2. req.params.access_token; //returns undefined

Since req.param('access_token') which works but now deprecated, how can I access the property access_token ?

jdotdoe
  • 477
  • 2
  • 6
  • 18
  • Possible duplicate of [How to access the GET parameters after "?" in Express?](https://stackoverflow.com/questions/17007997/how-to-access-the-get-parameters-after-in-express) – JJJ May 13 '18 at 15:06

2 Answers2

3

Query parameter should be accessed from req.query. For instance

req.query["access_token"]

Popoi Menenet
  • 1,018
  • 9
  • 20
3

It doesn't work because what you have is a query parameter.

To access it use req.query.