• joshr
  • NEWBIE
  • 34 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies

I've obtained an access token via OAuth. When I use that access token to make a call to a custom Apex REST class, I get back a 401 Unauthorized with the response body of 

 

<?xml version="1.0" encoding="UTF-8"?><Errors><Error><errorCode>INVALID_SESSION_ID</errorCode><message>This session is not valid for use with the REST API</message></Error></Errors>

 I've verified that the user I've authenticated with has API access. The user has a Sys Admin profile so full access to everything in the org.

 

Does anyone have any thoughts on why I might be receiving this error?

  • July 03, 2012
  • Like
  • 1

I'm having an issue with the OAuth Refresh Token flow. I submit my request to the na14 instance and I successfully get back a response with an access_token. However, the instance_url in the response is for na4. When I then submit a request to a custom REST endpoint on na14, I get back a 401 Not Authorized. If I submit the same request to na4, I get back a 404 (as I would expect since the REST resource isn't on na4 but it does show that the access token is valid for na4).

 

To recap, I'm submitting a refresh token in order to get an access token. The request is submitted to na14. The access token comes back, but it is tied to the na4 instance.

 

Has anybody encountered this issue before and if so, how was it solved?

 

Thanks,

Josh

  • June 18, 2012
  • Like
  • 0

I've obtained an access token via OAuth. When I use that access token to make a call to a custom Apex REST class, I get back a 401 Unauthorized with the response body of 

 

<?xml version="1.0" encoding="UTF-8"?><Errors><Error><errorCode>INVALID_SESSION_ID</errorCode><message>This session is not valid for use with the REST API</message></Error></Errors>

 I've verified that the user I've authenticated with has API access. The user has a Sys Admin profile so full access to everything in the org.

 

Does anyone have any thoughts on why I might be receiving this error?

  • July 03, 2012
  • Like
  • 1

I've obtained an access token via OAuth. When I use that access token to make a call to a custom Apex REST class, I get back a 401 Unauthorized with the response body of 

 

<?xml version="1.0" encoding="UTF-8"?><Errors><Error><errorCode>INVALID_SESSION_ID</errorCode><message>This session is not valid for use with the REST API</message></Error></Errors>

 I've verified that the user I've authenticated with has API access. The user has a Sys Admin profile so full access to everything in the org.

 

Does anyone have any thoughts on why I might be receiving this error?

  • July 03, 2012
  • Like
  • 1