دستورهای cURL

SSO Code Snippets

Auth Code URL

https://<SSO-URL>/auth/realms/sso/protocol/openid-connect/auth?client_id=YOUR_CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=openid&state=RANDOM_STATE

Code to Token (curl)

curl -k -X POST "https://<SSO-URL>/auth/realms/sso/protocol/openid-connect/token" -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=authorization_code" -d "client_id=YOUR_CLIENT_ID" -d "client_secret=YOUR_CLIENT_SECRET_PROVIDED_BY_ADMIN" -d "redirect_uri=YOUR_REDIRECT_URI" -d "code=GIVEN_AUTH_CODE_FROM_PREVIOUS_STEP"

Userinfo (curl)

curl -k -X GET "https://<SSO-URL>/auth/realms/sso/protocol/openid-connect/userinfo" -H "Authorization: Bearer <ACCESS_TOKEN>"

Refresh Token (curl)

curl -k -X POST "https://<SSO-URL>/auth/realms/sso/protocol/openid-connect/token" -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=refresh_token" -d "client_id=YOUR_CLIENT_ID" -d "client_secret=YOUR_CLIENT_SECRET_PROVIDED_BY_ADMIN" -d "refresh_token=YOUR_REFRESH_TOKEN"