Get API Token 'from' IFrame

Hello there,
I am trying to do get a API user Token from an integrated chat Iframe.
My purpose is to let all the login stuff to my chat server, and just know if the user is logged or not, and if he is, retrieve is name-avatar-status etc…
And with this identity, automaticaly create a channel if it does not exist…
I am doing someting wrong in my logic ?