@@ -147,6 +147,39 @@ request in the "Authorization" header.
147147 ...
148148 }
149149
150+ ### 5. Reseting the Access Token
151+
152+ If you have an access token set and need to remove it from the property store
153+ you can remove it with the reset() command. Before you can call reset you need
154+ to pass the property store.
155+
156+ function clearService(){
157+ OAuth2.createService('drive')
158+ .setPropertyStore(PropertiesService.getUserProperties())
159+ .reset();
160+ }
161+
162+ ### 6. Setting the Token format mode
163+
164+ OAuth services can return a token in two ways: as JSON or an URL encoded
165+ string. You can set what format the the token is in with the setTokenFormat(Mode).
166+ There are two ENUMS to set the mode: TOKEN_FORMAT.FORM_URL_ENCODED and TOKEN_FORMAT.JSON.
167+ JSON is set as default if no token format is choosen.
168+
169+ function gitService() {
170+ return OAuth2.createService('git')
171+ .setAuthorizationBaseUrl('https://github.com/login/oauth/authorize')
172+ .setTokenUrl('https://github.com/login/oauth/access_token')
173+ .setClientId(PropertiesService.getScriptProperties().getProperty('ghClient_Id'))
174+ .setClientSecret(PropertiesService.getScriptProperties().getProperty('ghClient_Secret'))
175+ .setProjectKey('MFiKVY_UbWVN0OvyDZTwvash00DPSBbB3')
176+ .setCallbackFunction('authCallback')
177+ .setPropertyStore(PropertiesService.getUserProperties())
178+ .setScope('gist,repo,user')
179+ .setTokenFormat(OAuth2.TOKEN_FORMAT.FORM_URL_ENCODED);
180+ }
181+
182+
150183
151184## Compatiblity
152185
0 commit comments