Reputation: 397
this is my code
function kakaoLogin() {
RNKakaoLogins.login((err, result) => {
Alert.alert("token", result);}}
the result is below picture.
if i change like that
function kakaoLogin() {
RNKakaoLogins.login((err, result) => {
Alert.alert("token", result.token);}}
the result is
why it doesn't get token value? how do i get the token value?
Upvotes: 0
Views: 55
Reputation: 1601
I'm 99% sure, that your result is stringified, so thats why you have {token: ... }
, you should firstly parse response then try to show it.
const response = JSON.parse(result);
Alert.alert("token", response.token); // now response is parsed object and property toke is accessible
Upvotes: 1