After looking at the Magento 2 REST token-base Authentication System. upon Successful login, I received an authorization token but I don't know how to get the current customer details with the token so I can know the current user.
Here is the instruction to get te token I followed. http://devdocs.magento.com/guides/v2.0/get-started/authentication/gs-authentication-token.html
you can use these methods to receive information about yourself (i guess you logged in as customer)
Retrieve default billing address for the given customerId:
GET http://Magento-2-0/index.php/rest/V1/customers/me/billingAddress
Retrieve default shipping address for the given customerId:
GET http://Magento-2-0/index.php/rest/V1/customers/me/shippingAddress
To retrieve common customer info you should use:
GET http://Magento-2-0/index.php/rest/V1/customers/me
response should be something like:
{
"id": 0,
"groupId": 0,
"defaultBilling": "string",
"defaultShipping": "string",
"confirmation": "string",
"createdAt": "string",
"updatedAt": "string",
"createdIn": "string",
"dob": "string",
"email": "string",
"firstname": "string",
"lastname": "string",
"middlename": "string",
"prefix": "string",
"suffix": "string",
"gender": 0,
"storeId": 0,
"taxvat": "string",
"websiteId": 0,
"addresses": [
{
"id": 0,
"customerId": 0,
"region": {
"regionCode": "string",
"region": "string",
"regionId": 0,
"extensionAttributes": {}
},
"regionId": 0,
"countryId": "string",
"street": [
"string"
],
"company": "string",
"telephone": "string",
"fax": "string",
"postcode": "string",
"city": "string",
"firstname": "string",
"lastname": "string",
"middlename": "string",
"prefix": "string",
"suffix": "string",
"vatId": "string",
"defaultShipping": true,
"defaultBilling": true,
"extensionAttributes": {},
"customAttributes": [
{
"attributeCode": "string",
"value": "string"
}
]
}
],
"disableAutoGroupChange": 0,
"extensionAttributes": {},
"customAttributes": [
{
"attributeCode": "string",
"value": "string"
}
]
}
Each call should have header "Authorization":"Bearer token"