I have created a connected app in which I have selected the OAuth Scopes "Access and manage your data (api)" and "Full access (full)" through the consumer key and consumer secret that was available in the new connected app, I have generated an access token.
But when I send a new put request to the RestResource that I have created in my sandbox instance, with the header key as "Authorization" and value as "Bearer my_access_token" I am receiving the below error.
[
{
"message": "Session expired or invalid",
"errorCode": "INVALID_SESSION_ID"
}
]
the url to which I am sending the request looks like this
https://my_instance_url/services/apexrest/CustomerAccountSync
I tried changing the way I send access token by adding "OAuth" instead of "Bearer" in the header. But I am still receiving the same error response.
Can anyone please let me know why this is happening? I am using "Insomnia" to make the API call.