-
Notifications
You must be signed in to change notification settings - Fork 66
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
badly formed callback request to exchange authorization code for token #48
Comments
Well, as a follow up, I tried following the Rails web app quick-start completely from scratch here: I downloaded and configured a fresh seeded project from here: I configured a completely new account for this seed, created a user, verified their email etc. and tried to authenticate using the Rails web app seed project... and... It. This is all I can get, below, a callback from Auth0 with an authorization code, and then nothing, the omniauth-auth0 gem does not exchange the authorization code for a token or populate the omniauth hash and the seed app just redirects to the login page. The Auth0 dashboard logs show this as a "successful" login.
Does anyone at Auth0 want to address this? My support ticket with Auth0 has been sitting there for a week with no response. There have never been any responses to any issues reported here in the omniauth-auth0 github repo by the Auth0 committers. Is anyone at Auth0 actively working on this gem? Is Auth0 interested in customers that use Rails? For context, we've successfully integrated omniauth-facebook, omniauth-google-oauth2, omniauth-linkedin, omniauth-twitter and so on into our stack in production over the years, so we feel like this is a real issue with the omniauth-auth0 gem, not a 'newbie' question. Regards, |
i have the same issue. |
i solved it :) ,, just generate a new token it will resolve the issue. |
Why is this issue still open? |
Ahmad's solution did not solve the original issue.
…On Mon, Mar 27, 2017 at 5:03 AM Claudio Floreani ***@***.***> wrote:
Why is this issue still open?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#48 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AQAS75exCciCMqXRUhvJRzIZE8zXJd35ks5rp4lwgaJpZM4MDR-w>
.
|
Sorry for the long delay, picking up on this repo now. We will be going through some updates soon. |
@joshcanhelp ensure the QS and sample works after updates and lets circle back. |
Sorry, we have already dropped Auth0 for lack of support :/. Perhaps we will give it another try sometime. |
@jakeNiemiec - Sorry to hear that but totally understand. For anyone else having this issue ... this gem was built to use the universal login page, not Lock. The Rails quickstart uses this method (redirecting to a login page and back). That said, Lock should work just fine as well, assuming it's configured properly. I'm testing that now and will post back if I find an issue or have a working config I can share. |
So, I can confirm that this gem works fine with Lock when configured properly. Here is the controller to grab the values Lock needs: Note the Assuming we already have jQuery globally, here is how Lock is initialized: In the code above, I see Closing this for now. Please feel free to post back if this is still an issue for anyone. |
Same error here. Abruptly stopped working last week, now looks incredibly foggy. Followed the Rails tutorial without success like you guys. Does anyone has a clue how to get a simple authentication Rails app working? |
@cassiopagnoncelli - Like I mentioned above, I have this working locally by following the quickstart. It sounds like you and others are still having a problem so I'll walk through that again and see if there are any steps missing. For anyone that's still having this issue, can you post your Ruby and Rails versions used? |
Having same problem here. Everything worked fine with the embedded login with Lock 9. Now that I've upgraded to Lock 11, lock will not redirect after authentication; although I've confirmed through the Auth0 dashboard logs and the Lock UI itself that the user was successfully authenticated. I looked at the Rails quickstart, but that example does not show what to do for embedded login pages - it only shows how to redirects to the universal login page. Since Lock 9 allowed embedded login pages, it only makes sense that Lock 11 should allow the same AND the changes should be documented. Using: Any help with this will be appreciated. I've spent over a week trying to upgrade and we're at the point where we may need to consider an other option. |
@joshcanhelp Thing is, without changing Auth0 code nor other configuration last deploy here got authentication never to work again on production. Turns out Auth0 actually sends the code back to the webapp upon providing the credentials, then it yields Bad Gateway. Because most production servers, like mine, sit behind a load balancer / reverse proxy so it may need extra attention there. Would like to hear from you guys having your Rails app behind Nginx with https redirection how you're solving the problem. Using: |
I appreciate all the extra information on this everyone and apologies for the trouble. I wasn't aware that this was such a wide-spread issue. Troubleshooting this issue and making sure the quickstart is clear is a high priority. If anyone has any additional information, please post that here. Otherwise, expect to hear back in a few days with a fix or request for more information. Thank you! |
We had the same setup, did not find a solution. |
FYI. I did try using the hosted page for universal login and I saw that the version of lock is v9 (which is supposed to be deprecated). I tried updating lock to v11 and I could not get it to redirect to my rails app either. I don't have a good example of what the configuration is supposed to look like for the universal login with lock 11, so it could be a configuration issue. Either way, it would be very helpful if there were documentation. Thanks. |
@coros-sanborn - Lock on the universal login page does not need to be upgraded or changed in any way. The deprecation relates to embedded Lock, meaning a Lock widget on your site, and pertains to cross-origin authentication. Since the universal login page is on the same domain, there's no deprecation there. Did the universal login page work? That's the way we recommend setting it up (and the way my test app was setup). If not, was it the same issue? |
@cassiopagnoncelli @jakeNiemiec - Do you mean that you're redirecting from |
@joshcanhelp - After a bit of a closer look, the universal login page "wants" to work, however it's not returning all the needed data (like before), specifically the user roles. With lock 9, and the embedded login page we were getting the role information for the user, now we do not get that information so the app errors out. Ideally, we want the embedded app to work, as it did with Lock 9. Is there a way to specify the attributes that get returned? |
@joshcanhelp - One other issue with the Universal login. When creating an account and logging in for the first time a popup window comes up with the following message: "Hi email@example.com, "XXXX" is requesting access to your "XXX" tenant" We do not want that window to appear. This will be confusing to our users. How can we get rid of that window? |
By default, the ID token won't include any
We recommend using the universal page for a number of reasons but Lock should work fine. The basic ID token can store provider, uid, name, email, and email_verified, see above for the rest. I'm not sure where the app name would come from but you can use the client ID with the Management API, as explained above (or just store that mapping in your app).
Is that using |
Thanks for the reply. I guess the biggest issue is that I used to get this information back with embedded Lock 9 without having to create custom claims or use the universal login page. We used to get the app_metadata back which included the roles: The universal login (which is v9) should at least work and return the same information as embedded lock v9 - which it does not (since I no longer get the app_metadata). To be clear, I'm only looking at the universal login as a last resort. The issues stated in this thread still exist. I have a rails 4 app that had the embedded login page with lock 9. It worked fine for years. It stopped working in the last couple weeks because lock 9 was deprecated. As soon as I upgraded to lock 11 the page will no longer redirect, even if the user is authenticated. This is the problem that I and many others are having and we really need a resolution. If lock 9 worked then upgrading to lock 11 should work, maybe with a few tweaks, but the entire app should not fail. And to add to the challenge there is not any documentation on how to configure the embedded login with Rails. The quickstart example is only for using the universal login page. I'd be happy to provide any information to try to help get the embedded login working with Rails, since this is our preferred method for using Auth0. In the mean time I can use the universal lock page, but I need to get the same app_metadata as before. Thank you. |
@coros-sanborn - I'm worried we're getting a number of issues mixed together here. This one was created last year so it's not related to the deprecation. I opened up a new issue here so we can work together to figure this out. @cassiopagnoncelli - You might be getting a similar error (though it doesn't sound like it based on your last comment) but it sounds like a different issue from the original one posted here. Would you mind opening up a new issue with the details, plus an answer to my question above? We want this to work in as many places as possible and we're happy to help you figure out how to do that. For everyone else ... I just walked through the quickstart from start to finish and, besides a few gaps related mostly to views (just put through a PR to fix that) I was able to get it working without an issue. Rails 5.2.0, Ruby 2.5.1p57, just running on Puma locally. Like the quickstart, this is using the universal login page. If you're using Lock (including @coros-sanborn) and things stopped working as expected last week, that's likely due to the deprecation of Lock 9. We have a migration guide here that walks through what changed and how to fix it in detail. You can also turn that API back on under your tenant settings but that will only last until Monday when it goes dark for good. |
We've updated the quickstart based on the feedback here and tested it start to finish a few times. This thread discusses a number of different issues so if you have a specific one we can help with, please open a new thread with reproduction steps and we'll take a look. |
Myself and 2 other posters here are all reporting that it didn't work on Rails 4.x. Assets are served very differently between the two. |
@jakeNiemiec - One of the posters above had an issue that was not related to the Rails version, rather a legacy authentication API endpoint. Still, we want this to work on as many platforms as possible and, if needed, provide tutorials/documentation for older, supported versions of languages and frameworks. To that end, I just walked through this quickstart using Ruby 2.5.1 and Rails 4.2.10 and was able to get it working with no changes to the provided steps. |
Hi there,
I'm trying to implement omniauth-auth0 as a provider in our rails 4 app. I'm using the Auth0 lock widget in a modal to initiate the login process.
We use devise and omniauth and already successfully implement various providers like google, facebook and linkedin. I used a similar implementation to the one described here: #6
For some reason, the omniauth-auth0 gem is generating a badly formed request to extract the access token from the authorization code and exchange it for the id token as described here: https://auth0.com/docs/client-auth/server-side-web#exhange-the-access_code-for-an-id_token
Here is an example trace of the request and response:
I can do this exchange myself in the terminal via a curl and it works fine. See below.
Below are example log traces left in the Auth0 dashboard, the pattern is a failed exchange immediately following a successful login.
Any help would be appreciated!
Regards,
Ramie
The text was updated successfully, but these errors were encountered: