Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Salesforce by (11.9k points)

I'm trying to get access to salesforce report data using OAuth token. Some time ago it worked fine, I used the OAuth token as the session ID.

...

URL remoteFile = new URL(instanceURL + "/" + reportId + "?export=1&enc=UTF-8&xf=csv");

URLConnection fStream = remoteFile.openConnection();

fStream.setRequestProperty("Cookie", "sid=" + accessToken);

...

But it doesn't work, every time I try to access the URL it returns an HTML page which corresponds to the login page. Is there any way I can access report data (not meta-data) using the OAuth access_token?

Thanks.

1 Answer

0 votes
by (32.1k points)

In order to use the token with such a URL, you need to set the scope parameter to include web:

web Allows the ability to use the access_token on the Web.

The oAuth User Agent Flow documentation details where the scope parameter is specified.

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94k users

Browse Categories

...