Diego81 / omnicontacts

A generalized Rack middleware for importing contacts from major email providers.
477 stars 231 forks source link

Hotmail & Yahoo contact import issue #112

Closed railsfactory-nandhini closed 9 years ago

railsfactory-nandhini commented 10 years ago

In yahoo contact import i m getting "internal_error".
In Hotmail I am getting the error like ,

Error not_authorized while processing /contacts/hotmail/callback: User did not grant access to contacts list

in my initializer I added like this. importer :yahoo,ENV['yahoo_client_id'],ENV['yahoo_secret_key'], {:callback_path => "/contacts/yahoo/callback"} importer :hotmail,ENV['hotmail_client_id'],ENV['hotmail_secret_key']

Please help me to fix this

vinhnglx commented 10 years ago

@railsfactory-nandhini with yahoo contact import, could you explain more detail for me about "internal_error"?.

vinhnglx commented 10 years ago

@railsfactory-nandhini You can refer my example at link: http://omnicontactsvinhnguyen.herokuapp.com/ or https://github.com/vinhnguyenleasnet/omnicontactvinhnguyen

railsfactory-nandhini commented 10 years ago

Hi vinhnguyenleasnet ,

Now it is working fine , if I change the initialize like the below.But Now the problem is always the facebook contact details are empty. I am having lot of contacts in facebook. When I try to import from facebook alone the list is empty.

Controller: contacts = request.env['omnicontacts.contacts'] Initializer: importer :facebook,ENV['facebook_client_id'],ENV['facebook_secret_key']

Is there any issue in that ?

Hotmail Changes: def initialize app, client_id, client_secret, options ={} super app, client_id, client_secret, options

railsfactory-nandhini commented 10 years ago

Hi vinhnguyenleasnet ,

I checked your application, there facebook contact is working fine.I did the same like you added.Any other additional setup there in facebook application.

I created a application & and added contact email , domain details and changed "Do you want to make this app and all its live features available to the general public?" this status and YES.

Any other configuration is there?

vinhnglx commented 10 years ago

Hi @railsfactory-nandhini. Here is your controller:

contacts = request.env['omnicontacts.contacts']

I think you should use instance variable. Here is the method:

def contact
    @contacts = request.env['omnicontacts.contacts']
    respond_to do |format|
      format.html 
    end
end

And views

<% unless @contacts.nil?%>
  <% @contacts.each do |c|%>
  <ul>
    <li><%= c[:name]%> :  <%= c[:email]%></li>
  </ul> 
  <%end%>
<%end%>
railsfactory-nandhini commented 10 years ago

Hi vinhnguyenleasnet,

def callback @contacts = request.env['omnicontacts.contacts'] redirect_to "#{imports_path}",:notice => "#{FLASH_MESSAGE["upload"]["success"]}" end

If I make it as instance variable also, @contacts is empty.

railsfactory-nandhini commented 10 years ago

https://graph.facebook.com/debug_token?input_token=input_token&access_token=token.

While checking this I m getting ,

{ "data": { "app_id": "id", "is_valid": true, "application": "local_test", "user_id": "user_id", "issued_at": 1413176476, "expires_at": 1418360476, "scopes": [ "public_profile", "email" ] } }

Like this. But if I added print in gemfile I m getting data set as empty.

"\"{\"data\":[]}\""

Is there any issue with the scope?

vikasbatra commented 10 years ago

I am too facing the same problem reported by @railsfactory-nandhini

In yahoo contact import i m getting "internal_error".

In Hotmail I am getting the error like ,

Error not_authorized while processing /contacts/hotmail/callback: User did not grant access to contacts list

Please share some sample code or configuration changes.

rtdp commented 10 years ago

I had similar issue with Hotmail. Referring @railsfactory-nandhini's code worked for me. Reference commit - https://github.com/rtdp/omnicontacts/commit/fc4845595d321876b6cc75d78007739c74bb731f

For yahoo issues, using the gem directly via github fixed it, instead of using via rubygems.

vinhnglx commented 10 years ago

@rtdp :+1: many thanks ... I'll apply hotmail now

rtdp commented 10 years ago

@vinhnguyenleasnet i have sent pull request - https://github.com/Diego81/omnicontacts/pull/114

luongtran commented 10 years ago

Hi @vinhnguyenleasnet, @rtdp, I already forked to my git and change as #114 but cannot get email. Here is log for hotmail responseL: Entry: {"id"=>"contact.39557cbf000000000000000000000000", "first_name"=>"Luong", "last_name"=>"Tran", "name"=>"Luong Tran", "is_friend"=>false, "is_favorite"=>false, "user_id"=>nil, "email_hashes"=>["2347bfc993ea4e778344d7d01979da2528d46ab6d6d0b658e0690ce58f6752b7"], "updated_time"=>"2014-10-16T08:44:37+0000", "birth_day"=>nil, "birth_month"=>nil}

This my change on hotmail.rb

def initialize app, client_id, client_secret, options ={} super app, client_id, client_secret, options @auth_host = "login.live.com" @authorize_path = "/oauth20_authorize.srf" @scope = options[:permissions] || "wl.signin, wl.basic, wl.birthday , wl.emails ,wl.contacts_birthday , wl.contacts_photos" @auth_token_path = "/oauth20_token.srf" @contacts_host = "apis.live.net" @contacts_path = "/v5.0/me/contacts" @self_path = "/v5.0/me" end

luongtran commented 10 years ago

Now it show me that the uri not valid

viniciusnz commented 10 years ago

To all! Please get the latest version of the gem on github (not on rubygems) and apply #111 . Both yahoo and hotmail imports are now working. Thanks @bigxiang !

railsfactory-nandhini commented 10 years ago

Hi all , Is there any update for facebook issue,

I got a comment like this for facebook contact import issue.

If your app was created at Facebook on or after April 30th 2014, your app won't be able to call v1.0 of the API.

In v1.0, the response included all of a person's friends.

In v2.0, the friends API endpoint returns the list of a person's friends who are also using your app.

More info in Facebook documentation: https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_user_ids

railsfactory-nandhini commented 9 years ago

Hey, Anyone having the issue like the above?

rubytastic commented 9 years ago

@railsfactory-nandhini No, I merely Maintain this repo as im not using it myself at the moment.

If anyone is interested in contributing then please write me a personal message.

rubytastic commented 9 years ago

Since the orginal question is resolved could you please make a new issue @railsfactory-nandhini for the facebook related issue? Thank you