If you are getting the "The state token is invalid or has expired. Please try again." while building an Add-on for Google Drive Documents/Sheets with oAuth.
It is possible that your OAuth server just cuts off the part of the state token parameter.
In case of magento just increase the size of oauth callback_url columns from 255 to 512 chars.
ALTER TABLE oauth_consumer MODIFY callback_url VARCHAR(512);
ALTER TABLE oauth_consumer MODIFY rejected_callback_url VARCHAR(512);
ALTER TABLE oauth_token MODIFY callback_url VARCHAR(512);
Or via update script (something like that)
ALTER TABLE oauth_consumer MODIFY rejected_callback_url VARCHAR(512);
ALTER TABLE oauth_token MODIFY callback_url VARCHAR(512);
Or via update script (something like that)
$adapter = $installer->getConnection();
$tagsTableName = $installer->getTable('oauth/consumer');
$adapter->modifyColumn($tagsTableName, 'callback_url', 'VARCHAR(512)');
$adapter->modifyColumn($tagsTableName, 'callback_url', 'VARCHAR(512)');
$tagsTableName = $installer->getTable('oauth/token');
$adapter->modifyColumn($tagsTableName, 'callback_url', 'VARCHAR(512)');
$installer->endSetup();
Update: This issue has been fixed by me in magento 2
https://github.com/magento/magento2/pull/2124
Links:
- https://developers.google.com/apps-script/add-ons/
- https://developers.google.com/apps-script/reference/script/state-token-builder
No comments:
Post a Comment