@@ -147,10 +147,42 @@ request in the "Authorization" header.
147
147
...
148
148
}
149
149
150
-
151
150
## Compatiblity
152
151
153
152
This library was designed to work with any OAuth2 provider, but because of small
154
153
differences in how they implement the standard it may be that some APIs
155
154
aren't compatible. If you find an API that it does't work with, open an issue or
156
155
fix the problem yourself and make a pull request against the source code.
156
+
157
+ ## Other features
158
+ ####Reseting the Access Token
159
+
160
+ If you have an access token set and need to remove it from the property store
161
+ you can remove it with the ` reset() ` function. Before you can call reset you need
162
+ to set the property store.
163
+
164
+ function clearService(){
165
+ OAuth2.createService('drive')
166
+ .setPropertyStore(PropertiesService.getUserProperties())
167
+ .reset();
168
+ }
169
+
170
+ ####Setting the Token Format
171
+
172
+ OAuth services can return a token in two ways: as JSON or an URL encoded
173
+ string. You can set which format the token is in with ` setTokenFormat(tokenFormat) ` .
174
+ There are two ENUMS to set the mode: ` TOKEN_FORMAT.FORM_URL_ENCODED ` and ` TOKEN_FORMAT.JSON ` .
175
+ JSON is set as default if no token format is chosen.
176
+
177
+ function gitService() {
178
+ return OAuth2.createService('git')
179
+ .setAuthorizationBaseUrl('https://github.com/login/oauth/authorize')
180
+ .setTokenUrl('https://github.com/login/oauth/access_token')
181
+ .setClientId('...')
182
+ .setClientSecret('...')
183
+ .setProjectKey('...')
184
+ .setCallbackFunction('authCallback')
185
+ .setPropertyStore(PropertiesService.getUserProperties())
186
+ .setScope('gist,repo,user')
187
+ .setTokenFormat(OAuth2.TOKEN_FORMAT.FORM_URL_ENCODED);
188
+ }
0 commit comments