You need to sign in to do that
Don't have an account?
mintotsai@dev.jasmine
Identity URL returns Bad_OAuth_Token
When using the Identity URL, I have a client who is getting Bad_OAuth_Token. The same code works in the same instance for other clients. The instance is na16.
The code is:
The error return is:
Please help!
The code is:
static public String protocolAndHost { get { if (protocolAndHost == null) { //memoize String orgId = UserInfo.getOrganizationId(); String userId = UserInfo.getUserId(); String sessionId = UserInfo.getSessionId(); //use getSalesforceBaseUrl within batches and schedules (not Visualforce), and fix inconsistent protocol if (sessionId == null) return Url.getSalesforceBaseUrl().toExternalForm().replace('http:', 'https:'); PageReference pr = new PageReference('/id/' + orgId + '/' + userId); pr.getParameters().put('oauth_token', sessionId); pr.getParameters().put('format', 'json'); //within test context use url class, else derive from identity api String data = Test.isRunningTest() ? '{"urls": {"rest": "' + Url.getSalesforceBaseUrl().toExternalForm() + '"}}' : pr.getContent().toString(); Map<String,Object> result = (Map<String,Object>)Json.deserializeUntyped(data); Map<String,Object> urls = (Map<String,Object>)result.get('urls'); //compose pod from the REST endpoint Url rest = new Url((String)urls.get('rest')); protocolAndHost = rest.getProtocol() + '://' + rest.getHost(); } return protocolAndHost; } }
The error return is:
403 status code return from request to https://na16.salesforce.com/id/00Dj0000001tO6KEAU/005j000000BYfmLAAT?format=json&oauth_token=00Dj0000001tO6K%21AQwAQHsiQOYRd7vpLI2.iY0vRYMzUbbiXUkZQiLdx593O2hxAbtIrbjU3TfYa6KTNPBAeVA.Pg3pUQQOrWlJgbsbG7ppWcU8&inline=1 An unexpected error has occurred. Your solution provider has been notified.
Please help!
Can you please provide me with the effected org id and the date on which this error was encountered so that we will try and check in our internal tools and update you on the same.
Best Regards
Naga kiran
The affected org is 00Dj0000001sold.
After further research, I found that the error is caused by the Spring '15 Session Setting: Lock sessions to the domain in which they were first used.
Thanks for your help.
"Lock sessions to the domain in which they were first used"
Is there any counter issue related to that?
Thanks
Thanks - Mohsin