简体   繁体   中英

How to get twitter user name from request.env[“omniauth.auth”] (Rails)

I am using Omni auth in my application. I could able to recieve token and secret by using below code..

auth = request.env["omniauth.auth"]
@token = auth['credentials']['token']
@secret = auth['credentials']['secret']

but i am stuck with getting the user name of the twitter account. is it possible for me to get user name from this?

meanwhile i am searching for solution.

Thanks

I got it. The username can be fetched by using auth['info']['name'] I tried printing the return in Json format and can able to find this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM