Quantcast
Channel: DreamFactory Forum - Latest posts
Viewing all articles
Browse latest Browse all 5028

Get user/session returns 401 error

$
0
0

Hi,

I'm trying to implement a function in a mobile app that checks whether the user is signed in, by using a get request to user/session.

I can successfully send a POST request to user/session and received the user_token.

But when i try and do a get request with the received token i get a 401 error.

This is what i did.

checkUserState() {
console.log(toString(this.state.token));
axios.get(url, {
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'X-DreamFactory-Session-Token': this.state.token,
    'X-DreamFactory-Api-Key': apiKey
  }
})
.then(response => {
  console.log(response.status);
})
.catch(error => console.log(error));
}

Any help would be greatly appreciated. Thanks!


Viewing all articles
Browse latest Browse all 5028

Trending Articles