oauth 2.0 - Getting Invalid redirect_uri using OAuth2 for Google Sheets -
i not sure use redirect uri. bitbucket has space "callback url" assuming entered. else have problem/know how use redirect uri in situation? setting service object below.
function getbitbucketserviceoauth2() { // create new service given name. name used when // persisting authorized token, ensure unique within // scope of property store. return oauth2.createservice('bitbucket') // set endpoint urls, same google services. .setauthorizationbaseurl('https://bitbucket.org/site/oauth2/authorize') .settokenurl('https://bitbucket.org/site/oauth2/access_token') // set client id , secret, google developers console. .setclientid('wl6mqbgku7axd5kqun') .setclientsecret('jtrmqm5ug9feumaxecqrx95uqz8lcevw') // set name of callback function in script referenced // above should invoked complete oauth flow. .setcallbackfunction('authcallback') // set property store authorized tokens should persisted. .setpropertystore(propertiesservice.getuserproperties()) // set scopes request (space-separated google services). // .setscope('https://www.googleapis.com/auth/drive') // below google-specific oauth2 parameters. // sets login hint, prevent account chooser screen // being shown users logged in multiple accounts. //.setparam('login_hint', session.getactiveuser().getemail()) // requests offline access. //.setparam('access_type', 'offline') // forces approval prompt every time. useful testing, // not desirable in production application. .setparam('approval_prompt', 'force'); }
and getting authorize url below.
var authorizationurl = service.getauthorizationurl(); var template = htmlservice.createtemplate( '<a href="<?= authorizationurl ?>" target="_blank">authorize</a>. ' + 'reopen sidebar when authorization complete.'); template.authorizationurl = authorizationurl; var page = template.evaluate(); spreadsheetapp.getui().showsidebar(page);
any great!
when error 403 (or equivalent), see "read more" link. click on , copy paste expected link gives. now, use link generate new credentials in redirect uri.
this flow worked me. hope works too.
Comments
Post a Comment