Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

REST CONNECTOR locate the Authorization token

I am trying to connect to google analytics by following this guide http://help.qlik.com/Connectors/en-US/connectors/#../Subsystems/REST_connector_help/Content/1.0/Crea...

But I get stuck on step 7. Open Developer tools in Google Chrome and locate the Authorization token

How do i locate the token?

Labels (1)
62 Replies
Bjorn_Wedbratt
Former Employee
Former Employee

What dimensions and metrics are you trying to put in the URL? The example seems to indicate:

metrics=ga:transactionsRevenue

dimensions=ga:medium;ga:transactionRevenue

But as far as I can tell when looking at the API ga:transactionRevenue is not a dimension, but a metric.

If you're sure the query is correct (I'm no GA expert, sorry), then make sure any quotes in the string are escaped properly.

For example " could be replaced with chr(34) and ' with chr(39), making sure quoting is not breaking up the string when built in the script:

let vRequestBody = replace(vRequestBody,'"', chr(34)&chr(34));

lars_plenge
Partner - Contributor III
Partner - Contributor III

Hi Björn

ids               ga:98567028

start-date     2016-02-02

end-date      2016-02-09

metrics        ga:transactionRevenue

dimensions  ga:medium, ga:campaign

filters          ga:medium==email 

max-results 10

sort             -ga:transactionRevenue 

BUT THERE IS A BUG IN THE CONNECTOR:

it some times put %% where there only shoud be %, so the fix was to amend "%%" to "%" and "%2" to "=" in the variable

agigliotti
Partner - Champion
Partner - Champion

I'm getting in troubles with the same issue.

I'm using REST connector (Linkedin) within both QlikView and Qlik Sense.

Did you find any solution?

Not applicable
Author

Hi,

Great work on the scripts, very usefull!

I do have a slight problem though, I think it is a noobish thing... I am getting an error on the refresh token part of the script. I think it has to do with my client_id. It is an authorization error, so it should be...

I did make a project in the dev console, set the authentication, etc etc. Still not able the get the respons, but the error...

Thanks in advance for any advice...

Not applicable
Author

I figured it out. Was struggeling with the right refreshtoken and OAuth Playground.

Sorry for bugging...

john9inno
Creator
Creator

Hi Bjorn,

I just have a simple question.

From this script, I just need to change Client ID, Client Secret and Refresh token.

However, I am getting error message. Customer read fail.

You may confirm that script is still working?

thanks.

azaia_synt
Partner - Contributor
Partner - Contributor

Hi Bjorn,

I don't undersant how to set the rest connection in method POST (LIB: Google Authorization), which should be the Request body?

Thanks

anderseriksson
Partner - Specialist
Partner - Specialist

Don't get the Post request to refresh token working.

Have client id & secret from the project and got refresh and access token from Playground.

Access token works for fetching Google Analytics data but expires after a while.

I'm trying to use the token refresh script in QlikView after correcting the obvious misspelling vRequestBodyvRequestBody, but I get an error;

QVX_UNEXPECTED_END_OF_DATA: HTTP protocol error 401 (Unauthorized):

        'Bearer' authentication schema provided by the web-service is not supported or your credentials are not valid.Try using the 'Force basic authentication' connection option if the server accepts the OAuth authentication schema.

        Error: Custom read failed

Bearer is used with Authorization and Access token when reading from Google Analytics but now we are trying to get the Access token?

The token is expired thus we can't use it to authenticate to get a new one can we?

There is XUserId and XPassword in the Connect statement, should these be altered?

john9inno
Creator
Creator

Hi Anders,

Did you this part as well?

Bjorn and Karl explained at very detail about API connection to GA in this discussion.

It took some time but I could create the connection.

Ahh, Try and use a Custom OAuth endpoint instead of Google in OAuth2 Playground when setting up custom credentials. That will support a bearer token for the credentials.

See if that works

Not applicable
Author

Hi karl,

I been working on the same task and what I found that Rest connector is not a right practice with Google Analytics. You can get the data once with using all the methods above(Google API methods) but same data is not as you can design something. There will be no structure in that rec vied data .I Suggest please use QV Source to get data with proper format and you can automate it too