In my app I want to take access token for authorization purpose. When user log in to the system it generate tokens as below.
{ "email": "[email protected]", "tokens": "{'refresh': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTYxMzcwMzg2OSwianRpIjoiZmQ1MjU5ODVmNjMwNGI1NWFiNjJiNGVmYmNhMGUyNTMiLCJlbWFpbCI6InRlc3RAZ21haWwuY29tIn0.OAR-aUstvgPz8Yue7Zo8OFQyjvwCFK8_a5n84cPqLCs', 'access': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjEyNjY3MDY5LCJqdGkiOiJlMGZkZmUyNWI0OWI0ZDdmODJkYWE4YTJhZWUwYjdmZCIsImVtYWlsIjoidGVzdEBnbWFpbC5jb20ifQ.TKw15NmLbSdIRwXWiu6UiMIudaCe5ecqyANNvA7YLQg'}" }
It has both access and refresh tokens. But I just need access token for authorization purpose. How can I take just access token.
It is exactly a json object, so if you object is like obj where you are getting this response from the server. You should do below to get access:
obj.tokens.access
This should work.
1.4m articles
1.4m replys
5 comments
57.0k users