Still stuck on this - basically the <p><a href="<%= @login_url 
%>">Proceed</a></p>  on the login_prompt_path is nil - and hence clicking 
on this does not take a uesr anywhere. 

Any suggestions?

Thanks

Arjun

On Wednesday, March 29, 2017 at 2:44:33 PM UTC+5:30, Arjun Rajkumar wrote:
>
> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
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/fed3a577-1ee6-4589-b168-d01d0c517c05%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to