I have an angular UI that makes an API call when the user logs in using google and sends the generated access token through the header. The API call part looks like this:
this.http.get(
`${environment.nodeURL}/api/myApiCall`,
{ headers: { authorization: this.accessToken}
})
The API has been made using flask-Python3. I want to store that access token on a local variable in the API. Can anyone suggest how can I get the value? I tried to get the value the following way:
@api.route('/verify_token')
@api.response(404, 'Invalid access_token')
class UserCheck(Resource):
def get(self):
""" Checks if the access token is valid or not """
response = urllib.request.urlopen('http://localhost:5000/user/verify_token')
print("Header value is...............",response.getheader('access_token'))
I am currently running the UI and the API in localhost.