java - JHipster API authentification -
i used java hipster create rest api. want use rest api in java code (i'm developing android application). don't understand how authenticate me use rest api !
as example, api blabla/api/getuser
. firebug tried understand how call api. simulate http request post parameters ?id=x
, token in header (token got request login browser). it's okay, works, have information.
but now, in java code, can't send same http request because don't know token. how can ? how can log me admin ? know : login admin, password admin , url of api , parameters have send.
thank's !
oauth2
post
url: http://localhost:8080/oauth/token
in header: authorization: eg. 'basic y2xpzw50awq6y2xpzw50c2vjcmv0' base 64 encoding client details (source: www.base64encode.org/)
y2xpzw50awq6y2xpzw50c2vjcmv0 == clientid:clientsecret
in body:
- username
- password
- grant_type
- scope
curl -x post -vu clientid:clientsecret http://localhost:8080/oauth/token -h "accept: application/json" -d "username=admin&password=admin&grant_type=password&scope=read"
edit: in android @ retrofit square
Comments
Post a Comment