Hi, 

Just looking to learn more about the Adwords API, and thought i'll test the 
adwords_on_rails example on my local system. 

The example always starts by authenticating a user if a user is not signed 
in. 

# Checks if we have a valid credentials.
  def authenticate()
    token = session[:token]
    redirect_to login_prompt_path if token.nil?
    return !token.nil?
  end


Over here as the session[:token] is nil - it redirects to the 
login_prompt_path

This is the code for that 

def prompt()
    api = get_adwords_api()
    if session[:token]
      redirect_to home_index_path
    else
      begin
        token = api.authorize({:oauth2_callback => login_callback_url})
      rescue AdsCommon::Errors::OAuth2VerificationRequired => e
        @login_url = e.oauth_url
      end
    end
  end

Over here it authorises the api and gets the token details. 

>From my app - these are the details.

token:

pry(#<LoginController>)> token

=> {:access_token=>*"*
ya29.GlwdBFmXLFG6N4LZcXYZXXYZXYZsI3w2TO7S2AT8jxg2H5M9fZK8w*"*,

 :refresh_token=>*"*1/MRi81Wp0D0XYZXXYZXYZsSsioOgHxas*"*,

 :issued_at=>*2017*-*03*-*29* *09*:*11*:*29* +*0530*,

 :expires_in=>*3600*,

 :id_token=>*nil*}

[2] pry(#<LoginController>)> @login_url

=> *nil*

Then in the view for login_prompt_path - it says this. 

<p>Please authorize with a google account first:</p>
<p><a href="<%= @login_url %>">Proceed</a></p>


I understand that I need to click on Proceed so that I can select an 
Adwords account for this example.
However, my @login_url is always nil - so the clicking on Proceed - does 
nothing. 

Can someone please help me solve this. I seem to be doing something wrong - 
but have copied this code from the example. 

Would really help to get some answers to this. Thanks for your time.

Arjun


-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/c529149d-4930-45c3-8795-81585810658d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • Not able to aut... Arjun Rajkumar

Reply via email to