Sunday, October 19, 2014

Obtain Access Token form WSO2 Identity Server Token Endpoints

Authorization Code Grant Type

https://localhost:9443/oauth2/authorize?
response_type=code&
client_id=0rhQErXIX49svVYoXJGt0DWBuFca&
redirect_uri=https%3A%2F%2Fmycallback

https://mycallback/?code=9142d4cad58c66d0a5edfad8952192

curl -v -X POST --basic
-u 0rhQErXIX49svVYoXJGt0DWBuFca:eYOFkL756W8usQaVNgCNkz9C2D0a
-H "Content-Type:application/x-www-form-urlencoded;charset=UTF-8" -k
-d "grant_type=authorization_code&
code=9142d4cad58c66d0a5edfad8952192&
redirect_uri=https://mycallback" https://localhost:9443/oauth2/token

Implicit Grant Type

https://localhost:9443/oauth2/authorize?response_type=token&
client_id=0rhQErXIX49svVYoXJGt0DWBuFca&
redirect_uri=https%3A%2F%2Fmycallback

https://mycallback/#access_token=cac93e1d29e45bf6d84073dbfb460&expires_in=3600

Resource Owner Password Credentials Grant Type

curl -v -X POST --basic
-u 0rhQErXIX49svVYoXJGt0DWBuFca:eYOFkL756W8usQaVNgCNkz9C2D0a
-H "Content-Type:application/x-www-form-urlencoded;charset=UTF-8" -k
-d "grant_type=password&
username=admin&password=admin"
https://localhost:9443/oauth2/token

{
"token_type":"bearer",
"expires_in":685,
"refresh_token":"22b157546b26c2d6c0165c4ef6b3f736",
"access_token":"cac93e1d29e45bf6d84073dbfb460"
}

Client Credentials Grant Type

curl -v -X POST --basic
-u 0rhQErXIX49svVYoXJGt0DWBuFca:eYOFkL756W8usQaVNgCNkz9C2D0a
-H "Content-Type:application/x-www-form-urlencoded;
charset=UTF-8" -k

-d "grant_type=client_credentials" https://localhost:9443/oauth2/token