Hi Dan,
Sorry for the late reply.
Now the actual auth is working and the google api passes back its access token to the users. But my problem is I am unable to store this access token for the user and use it in other API calls inside QB.
When trying to set up a webhook I would need to pass that access token manually in the URL to make a succesful call.
I seem to have similar issues with other tokens which are not native QB tokens.
Is there someway to store an access token from a 3rd party either in a temporary QB record or in the local.storage of the user and then recall it from inside QB when triggering a webhooks ?
My codepage looks like this:
/*
* Create form to request access token from Google's OAuth 2.0 server.
*/
oauthSignIn();
function oauthSignIn() {
// Google's OAuth 2.0 endpoint for requesting an access token
var oauth2Endpoint = '
https://accounts.google.com/o/oauth2/v2/auth';
// Create <form> element to submit parameters to OAuth 2.0 endpoint.
var form = document.createElement('form');
form.setAttribute('method', 'GET'); // Send as a GET request.
form.setAttribute('action', oauth2Endpoint);
// Parameters to pass to OAuth 2.0 endpoint.
var params = {'client_id': 'xxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com',
'redirect_uri': '
https://domain.quickbase.com/db/bnzms2m4f',
'response_type': 'token',
'scope': '
https://www.googleapis.com/auth/dfatrafficking https://www.googleapis.com/auth/dfareporting https://www.googleapis.com/auth/ddmconversions',
'include_granted_scopes': 'true',
'state': 'pass-through value'};
// Add form parameters as hidden input values.
for (var p in params) {
var input = document.createElement('input');
input.setAttribute('type', 'hidden');
input.setAttribute('name', p);
input.setAttribute('value', params[p]);
form.appendChild(input);
}
// Add form to page and submit it to open the OAuth 2.0 endpoint.
document.body.appendChild(form);
form.submit();
console.log(params);
}
Thanks
Best regards
Shadi