lynndylanhurley / lynndylanhurley/devise_token_auth

with version 1.2.0 @data is not passed to the omniauth_external_window.html.erb

Open
#1,591 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
3.6k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

Hi, first of all, let me say that I have been using devise token auth since 2017 and I have integrated various types of authentications (with regular username and pwd) and other custom omniauth strategies with success. I have been using this library to authenticate with various web client apps (ember, react) flawlessly. Now after all these years, I decided to update the version of devise token auth from `1.1.0` to `1.2.0`. I am on `rails 6.1.7.1`.

I have been running the current specs for my code base and out of 509 examples, it seems that I have only 1 spec failing; by having a look at what is going on, it seems that for some unknown reason, the spec is failing since the `response.body` for the callback response is an empty string and the `@data` coming from the ` render_data(message, data)` method in the `omniauth_callbacks_controller.rb` is not passed to the `omniauth_external_window.html.erb` view (as instead it was happening with version `1.1.0`). This is totally weird, since if I directly debug from inside `devise_token_auth` and I inspect what is going on in the ` render_data(message, data)` method my `@data` is there, here is an example of calling `@data.to_json` from the method

```
"{\"auth_token\":\"ABCDERWEEWWEFR\",\"client_id\":\"DAFAFDFDSFDSF\",\"uid\":\"123456\",\"expiry\":1684595450,\"config\":null,\"email\":\"user@email.com\",\"username\":\"username-123456\",\"fullname\":\"User name \",\"id\":1,\"created_at\":\"2019-12-18T13:48:54.252Z\",\"updated_at\":\"2023-04-20T15:10:50.346Z\",\"deleted_at\":null,\"invitation_token\":null,\"invitation_sent_at\":null,\"invitation_accepted_at\":null,\"invitation_limit\":null,\"invited_by_id\":null,\"invited_by_type\":null,\"invitation_created_at\":null,\"show_archived_experiments\":false,\"avatar\":null,\"url\":null,\"location\":null,\"laboratory\":null,\"show_archived_reagents\":false,\"show_tasks\":\"all\",\"provider\":\"idplus\",\"persistent_allow_password_change\":false,\"investigator_id\":null,\"show_archived_data\":false,\"allow_password_change\":false,\"investigator_lock\":null,\"inst_assoc\":\"INST\",\"indv_identity\":\"REG\",\"indv_identity_method\":\"U_P\",\"inst_assoc_method\":\"CSCREATED\",\"inst_acct_id\":\"1243423\",\"inst_acct_name\":\"Maintenance \",\"inst_acct_image\":\"http://domain.com/institution.JPG\",\"path_choice\":false,\"policy_success\":[\"urn:com:domain:idp:policy:product:indv_identity\",\"urn:com:domain:idp:policy:product:inst_assoc\"],\"message\":\"deliverCredentials\"}"
```

but to my great surprise, it seems that when I am redirected to `auth/provider/callback` page, this page is always empty, no js is executed (I tried to put a `console.log` in there to see if I could debug something from the view), I even tried to manually place some plain text in the body to understand if I could at least have the `@data` included in this page by using simple ERB but no matter what, this is always rendering an empty page: the `@data` is not passed to the view and the sign in is successfull, since if I inspect the current user, this user is signed in and authenticated to the rails app (the sign in count is updated in my db table) but the `@data` is not passed anymore in the view with version `1.2.0` as it was happening with version `1.1.0` and no js is executed, I am totally stuck on this and I do not understand if this has anything to do with the new changes in the version `1.2.0` or if this has something to do with the version of rails, has anyone by chance experienced this same type of issue with version `1.2.0` of devise token auth? Any kind of support on this would be highly appreciated, thanks in advance!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failing callback using omniauth_callbacks_controller.rb and the omniauth_external_window.html.erb view, starting with the render_data(message, data) path and the current failing spec. Compare the callback response behavior between versions 1.1.0 and 1.2.0; done means the callback response contains the rendered data and executes the expected view JavaScript without breaking sign-in.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
authentication
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.