[英]How to get twitter user name from request.env[“omniauth.auth”] (Rails)
I am using Omni auth in my application. 我在我的应用程序中使用Omni auth。 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. 但我仍然坚持获取Twitter帐户的用户名。 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. 可以使用
auth['info']['name']
获取用户auth['info']['name']
我尝试以Json格式打印返回,并且能够找到它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.