Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ouath2_authorize.html.erb issues and won't redirect back to client app's url... #62

Closed
pjammer opened this issue May 2, 2011 · 5 comments

Comments

@pjammer
Copy link

pjammer commented May 2, 2011

hi.

I have to comment out oauth2_authorize.html.erb in order for it to "work" (i.e., show up)

<%# link_to @token.client_application.name,@token.client_application.url %> (<%# link_to @token.client_application.url,@token.client_application.url %>

So @token is being passed as Nil::NIlClass and that doesn't have an associaiton. So the only way to get passed this was for me to comment them out.

Now, i think the same @token being nil is effecting the second part.

In the oauth2_authorize.html.erb file, I can "authorize" the app , but after clicking submit it doesn't redirect me back to my original app.com/auth/whatever/callback like it should.

Using omniauth's provider :oauth2 I think I'm setting it up right, but they don't have a spec to copy from in their tests... so maybe they send the url different. See, I tried oauth as the provider and I'd get back to my callback url, but there were other issues that screwed that up.

I'll take any help. thanks.

@pjammer
Copy link
Author

pjammer commented May 2, 2011

Why does a post render a view and not redirect?

That is what I've got so far on this issue I'm having. Maybe it stems from the @token thing being nil?

Also in the form for your generated oauth2_authorize view, it goes to authorize_url and we don't have a POST route for it, should we? I may not know enough about rails 3 routing but i thought each match .... needed a :method call too?

I'm using pre4, fwiw.

@pjammer
Copy link
Author

pjammer commented May 2, 2011

In the generated view file for oauth2_authroize.html.erb, you need to change the hidden field to:

<%= hidden_field_tag "redirect_url", params[:redirect_uri]%>

I'll add a pull request once i get this invalid_credentials error figured out.

Is the Oauth2 stuff, f@cked up or something??

@pjammer
Copy link
Author

pjammer commented May 2, 2011

yeah, the oauth2_authorize.html.erb page should read @client_application not @token.client_application, as you don't pass an @token in the authorize method of the provider_controller.

I wish someone could answer me soon, i feel this is not complete or something and would like to be told if that is the truth, just so I know what I'm up against here.

oauth-plugin is still the only half decent choice for providers, or am I wrong?

@pjammer
Copy link
Author

pjammer commented May 3, 2011

hmm, why does

Started POST "/oauth/access_token"

go into oauth10_request_token when it should be oauth20_access_token i'd assume, for Omniauth sending back after the OauthVerifier record is created?

It's because of provider_controller.rb line 11:

oauthenticate :strategies => :oauth10_request_token, :interactive => false, :only => [:access_token]

If this is going to access_token automatically from my Omniauth'd app, I wonder if their :oauth2 strategy is passing it as an oauth provider instead?

@pjammer
Copy link
Author

pjammer commented May 3, 2011

I found out that your Oauth-plugin Oauth2.0 was half finished.

I'll be sending a pull request with what i did to get this working, no reason for it to be half finished and don't want someone else to go through this pain either.

@pjammer pjammer closed this as completed May 3, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant