This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun signOutWithoutRedirect() { | |
| val client = OkHttpClient() | |
| val request = Request.Builder() | |
| .url(Constants.URL_LOGOUT + authState.idToken) | |
| .build() | |
| try { | |
| client.newCall(request).execute() | |
| } catch (e: IOException) { } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private fun signOut() { | |
| try { | |
| val endSessionRequest = EndSessionRequest.Builder(authServiceConfig) | |
| .setPostLogoutRedirectUri(Uri.parse(Constants.URL_LOGOUT_REDIRECT)) | |
| .setIdTokenHint(authState.accessToken) | |
| .build() | |
| val intent = authorizationService.getEndSessionRequestIntent(endSessionRequest) | |
| launchIntent(intent) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "kind": "drive#fileList", | |
| "etag": "\"7rZMux5cSmcgs0RqY3HlcLd9n7U\"", | |
| "selfLink": "https:\/\/www.googleapis.com\/drive\/v2\/files", | |
| "incompleteSearch": false, | |
| "items": [{ | |
| "kind": "drive#file", | |
| "id": "1CpwK5Fq6YhsSMsKm_4IGBHTe52tuJfsf", | |
| "etag": "\"MTYzNjMwNjk4MjAwMA\"", | |
| "selfLink": "https:\/\/www.googleapis.com\/drive\/v2\/files\/1CpwK5Fq6YhsSMsKm_4IGBHTe52tuJfsf", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun makeApiCall() { | |
| authState.performActionWithFreshTokens(authorizationService, | |
| object: AuthState.AuthStateAction { | |
| override fun execute(accessToken: String?, idToken: String?, ex: AuthorizationException?) { | |
| GlobalScope.launch { | |
| async(Dispatchers.IO) { | |
| val client = OkHttpClient() | |
| val request = Request.Builder() | |
| .url(Constants.URL_API_CALL) | |
| .addHeader("Authorization", "Bearer " + authState.accessToken) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| authorizationService.performTokenRequest(tokenExchangeRequest) { response, exception -> | |
| if (exception != null) { | |
| authState = AuthState() | |
| } else { | |
| if (response != null) { | |
| authState.update(response, exception) | |
| jwt = JWT(response.idToken!!) | |
| } | |
| } | |
| persistState() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "iss": "https://accounts.google.com", | |
| "azp": "1080220280079-d0c0ba1076kdsr3d0pbuvd7e3npj1ket.apps.googleusercontent.com", | |
| "aud": "1080220280079-d0c0ba1076kdsr3d0pbuvd7e3npj1ket.apps.googleusercontent.com", | |
| "sub": "113059489806796372752", | |
| "email": "ptruiz.demo@gmail.com", | |
| "email_verified": true, | |
| "at_hash": "qoJUeD9qk0ofsdWxXcPMNw", | |
| "nonce": "_UYfnI9BuoDiWZMT-RIhbQ", | |
| "name": "Paul Ruiz", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| eyJhbGciOiJSUzI1NiIsImtpZCI6IjkzNDFhYmM0MDkyYjZmYzAzOGU0MDNjOTEwMjJkZDNlNDQ1Mzli | |
| NTYiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLCJhenAiO | |
| iIxMDgwMjIwMjgwMDc5LWQwYzBiYTEwNzZrZHNyM2QwcGJ1dmQ3ZTNucGoxa2V0LmFwcHMuZ29vZ2xld | |
| XNlcmNvbnRlbnQuY29tIiwiYXVkIjoiMTA4MDIyMDI4MDA3OS1kMGMwYmExMDc2a2RzcjNkMHBidXZkN | |
| 2UzbnBqMWtldC5hcHBzLmdvb2dsZXVzZXJjb250ZW50LmNvbSIsInN1YiI6IjExMzA1OTQ4OTgwNjc5N | |
| jM3Mjc1MiIsImVtYWlsIjoicHRydWl6LmRlbW9AZ21haWwuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRyd | |
| WUsImF0X2hhc2giOiJxb0pVZUQ5cWswb2ZzZFd4WGNQTU53Iiwibm9uY2UiOiJfVVlmbkk5QnVvRGlXW | |
| k1ULVJJaGJRIiwibmFtZSI6IlBhdWwgUnVpeiIsInBpY3R1cmUiOiJodHRwczovL2xoMy5nb29nbGV1c | |
| 2VyY29udGVudC5jb20vYS9BQVRYQUp4THlidm5aWERZcks4em0yWGdsT1NxdF9hbk1tU1AxX3ZxWGJ2c | |
| j1zOTYtYyIsImdpdmVuX25hbWUiOiJQYXVsIiwiZmFtaWx5X25hbWUiOiJSdWl6IiwibG9jYWxlIjoiZ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "request": { | |
| "configuration": { | |
| "authorizationEndpoint": "https:\/\/accounts.google.com\/o\/oauth2\/v2\/auth", | |
| "tokenEndpoint": "https:\/\/www.googleapis.com\/oauth2\/v4\/token", | |
| "endSessionEndpoint": "https:\/\/accounts.google.com\/o\/oauth2\/revoke?token=" | |
| }, | |
| "clientId": "1080220280079-d0c0ba1076kdsr3d0pbuvd7e3npj1ket.apps.googleusercontent.com", | |
| "nonce": "_UYfnI9BuoDiWZMT-RIhbQ", | |
| "grantType": "authorization_code", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "configuration": { | |
| "authorizationEndpoint": "https:\/\/accounts.google.com\/o\/oauth2\/v2\/auth", | |
| "tokenEndpoint": "https:\/\/www.googleapis.com\/oauth2\/v4\/token", | |
| "endSessionEndpoint": "https:\/\/accounts.google.com\/o\/oauth2\/revoke?token=" | |
| }, | |
| "clientId": "1080220280079-d0c0ba1076kdsr3d0pbuvd7e3npj1ket.apps.googleusercontent.com", | |
| "nonce": "_UYfnI9BuoDiWZMT-RIhbQ", | |
| "grantType": "authorization_code", | |
| "redirectUri": "com.ptruiz.authtest:\/oauth2redirect", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val tokenExchangeRequest = authorizationResponse.createTokenExchangeRequest() |
NewerOlder