In the app script, I want to add AuthType as OAUTH2 and implement Facebook authentication when users access the data studio. After that, I want to fetch the access token when the user comes back on callback after authentication.
function getAuthType() {
var cc = DataStudioApp.createCommunityConnector();
return cc.newAuthTypeResponse()
.setAuthType(cc.AuthType.OAUTH2)
.setClientId('********709369') // Replace with your App ID
.setClientSecret('*********03284c09d3') // Replace with your App Secret
.setScopes(['email', 'public_profile']) // Example scopes, adjust as needed
.build();
}
var cc = DataStudioApp.createCommunityConnector();
function getConfig(request) {
var cc = DataStudioApp.createCommunityConnector();
var config = cc.getConfig();
config.newInfo()
.setId('instructions')
.setText('Datablaster.io - Test');
try{
var accessToken = request.configParams.accessToken;
Logger.log(accessToken);
}catch (error) {
// Handle the error, e.g., display an error message in the config
config.newInfo()
.setId('error')
.setText('Error : ' + error.message);
Logger.log('Error :', error);
}
config.setDateRangeRequired(false);
return config.build();
}
function isAdminUser() {
return true;
}
=> appscript.json
Please provide proper documentation and information for how we can achieve this.