This file contains 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
<a href="https://AUTH_DOMAIN/authorize?scope=appointments%20contacts&audience=appointments:api&response_type=code&client_id=SEU_CLIENT_ID&redirect_uri=https://SEU_APP/callback"> | |
Sign In | |
</a> |
This file contains 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
curl --request POST \ | |
--url 'https://AUTH_DOMAIN/oauth/token' \ | |
--header 'content-type: application/json' \ | |
--data '{"grant_type":"authorization_code", | |
"client_id": "SEU_CLIENT_ID", | |
"client_secret": "SEU_CLIENT_SECRET", | |
"code": "SEU_AUTHORIZATION_CODE", | |
"redirect_uri": "https://SEU_APP/callback"}' |
This file contains 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
/* | |
Algumas aplicaçes exigem o envio do parâmetro "offline_access" no scope | |
para que o refresh_token seja retornado na requisição. | |
*/ | |
{ | |
"access_token": "ea765dxj...k4laWRt", | |
"refresh_token": "HUvRxJO...ekijnIbL", | |
"id_token": "uiJPXAi...8faeHeT", | |
"token_type": "Bearer" | |
} |
This file contains 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
curl --request GET \ | |
--url https://apidesejada.com/api \ | |
--header 'authorization: Bearer MEU_ACCESS_TOKEN_AQUI' \ | |
--header 'content-type: application/json' |
This file contains 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
curl --request POST \ | |
--url 'https://AUTH_DOMAIN/oauth/token' \ | |
--header 'content-type: application/json' \ | |
--data '{"grant_type":"refresh_token", | |
"client_id": "SEU_CLIENT_ID", | |
"client_secret": "SEU_CLIENT_SECRET", | |
"code": "SEU_AUTHORIZATION_CODE", | |
"redirect_uri": "https://SEU_APP/callback"}' |
This file contains 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
{ | |
"access_token": "eyJ...MoQ", | |
"expires_in": 86400, | |
"scope": "openid offline_access", | |
"id_token": "eyJ...0NE", | |
"token_type": "Bearer" | |
} |
This file contains 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
import java.net.InetSocketAddress; | |
import java.net.Socket; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.concurrent.Callable; | |
import java.util.concurrent.ExecutionException; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.Future; |
This file contains 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
public boolean portaEstaAberta(String ip, int porta, int timeout) { | |
try { | |
Socket socket = new Socket(); | |
socket.connect(new InetSocketAddress(ip, porta), timeout); | |
socket.close(); | |
return true; | |
} catch (Exception ex) { | |
return false; | |
} | |
} |