Skip to content

Instantly share code, notes, and snippets.

@xcommerce-gists
Last active August 2, 2019 09:19
Show Gist options
  • Save xcommerce-gists/4007896 to your computer and use it in GitHub Desktop.
Save xcommerce-gists/4007896 to your computer and use it in GitHub Desktop.
PayPalAccessOpenIDConnectOAuth.cURL
curl https://api.paypal.com/v1/identity/openidconnect/tokenservice \
-u "<your_app_id>:<your_app_secret>" \
-d "client_id=&grant_type=authorization_code&code=<code>&redirect_uri=<urlencoded_return_url>"
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-store
Pragma: no-cache
{ "access_token": "ElAV32hkKGlMT4H86HJK94f54HKDLZdf", "token_type": "Bearer", "refresh_token":
"ExLOxBtZp8JJHDHD9495HDHHDHFHFJHF", "expires_in": 900, "id_token":
"eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9zZXJ2ZXIuZXhhbXBsZS5jb20iLCJ1c2VyX2lkIjoiMjQ4Mjg5NzYxMDAxIiwiYXVkIjoiczZCaGRSa3F0MyIsIm5vbmNlIjoibi0wUzZftKVpFuc1pGaVsyZsOtkT32E4c6MDHeCvIDlR5ESC0ct8BLvGJDB5954MjCR4_X2GAEHonKw4NF8wTmUFvhslYXmjRNFs21Byjn3jNb7lSa3MBfVsw"
}
https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize?
client_id=<your_app_id>&response_type=code&scope=<scope>&redirect_uri=<return_url_provided_at_app_creation>&state=<state>&nonce=<nonce>
curl "https://api.paypal.com/v1/identity/openidconnect/userinfo?schema=openid&access_token=<your_access_token>"
GET https://api.paypal.com/v1/identity/openidconnect/userinfo?schema=openid HTTP/1.1
Authorization: Bearer _your-value_
HTTP/1.1 200 OK
Content-Type: application/json
{ "user_id": "https://www.paypal.com/webapps/auth/server/64ghr894040044", "name": "Jane Doe"
"given_name": "Jane", "family_name": "Doe", "email": "janedoe@paypal.com", }
curl "https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/endsession?id_token=<your_id_token>&state=<the_state_you passed_earlier>&redirect_uri=<your_return_url>&logout=true"
curl https://api.paypal.com/v1/identity/openidconnect/tokenservice \
-u "<client_id>:<your_app_secret>" \
-d "client_id=&grant_type=refresh_token&refresh_token=<your_refresh_token>&scope=<your_scopes>"
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-store
Pragma: no-cache
{ "access_token": "E7AV32hkKGlMT37595LZet", "token_type": "Bearer", "expires_in": 28800}
curl -d "access_token=<your_id_token>" https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/checkid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment