{"action":"created","issue":{"url":"https://api.github.com/repos/lynndylanhurley/devise_token_auth/issues/1010","repository_url":"https://api.github.com/repos/lynndylanhurley/devise_token_auth","labels_url":"https://api.github.com/repos/lynndylanhurley/devise_token_auth/issues/1010/labels{/name}","comments_url":"https://api.github.com/repos/lynndylanhurley/devise_token_auth/issues/1010/comments","events_url":"https://api.github.com/repos/lynndylanhurley/devise_token_auth/issues/1010/events","html_url":"https://github.com/lynndylanhurley/devise_token_auth/issues/1010","id":272439347,"node_id":"MDU6SXNzdWUyNzI0MzkzNDc=","number":1010,"title":"Cant login after signing in via oauth","user":{"login":"sushant12","id":8981250,"node_id":"MDQ6VXNlcjg5ODEyNTA=","avatar_url":"https://avatars0.githubusercontent.com/u/8981250?v=4","gravatar_id":"","url":"https://api.github.com/users/sushant12","html_url":"https://github.com/sushant12","followers_url":"https://api.github.com/users/sushant12/followers","following_url":"https://api.github.com/users/sushant12/following{/other_user}","gists_url":"https://api.github.com/users/sushant12/gists{/gist_id}","starred_url":"https://api.github.com/users/sushant12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sushant12/subscriptions","organizations_url":"https://api.github.com/users/sushant12/orgs","repos_url":"https://api.github.com/users/sushant12/repos","events_url":"https://api.github.com/users/sushant12/events{/privacy}","received_events_url":"https://api.github.com/users/sushant12/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-11-09T04:45:06Z","updated_at":"2018-08-11T04:38:55Z","closed_at":"2017-11-09T09:12:51Z","author_association":"NONE","body":"I have a rails-api app and I added the `gem 'omniauth-google-oauth2'` .  Everything is working fine up to showing an oauth screen and then clicking next to signup and the user is also saved into the db as well. But after that, I get an err saying 'Either signup or log in'. This is happening because I have a `before_action :authenticate_api_employee!` on my controllers.\r\n\r\nI did some research and found out that the `current_api_employee` is nil as well. Any idea how this can be fixed?\r\n\r\nI have overridden the omniauth_callbacks_controller and added a debugger there and current_api_employee have a value but it s value is set to nil after I am signed in and redirected.\r\n\r\nDo i need to add `?origin=http:/.....` to the oauth url ? It looks like the omniauth_success needs that url to redirect properly but I am overriding the omniauth_success method.\r\n\r\nWould really appreciate your help\r\n\r\n\r\nMy `ApplicationController` is extending from `ActionController::API` .\r\n\r\nMy Omniauth controller \r\n\r\n```\r\nmodule Overrides\r\n  class OmniauthCallbacksController < DeviseTokenAuth::OmniauthCallbacksController\r\n\r\n  \tdef omniauth_success\r\n      super do |resource|\r\n        if omniauth_window_type.present? # auth requested from angular\r\n           sign_in resource\r\n       else  # if backend standalone auth\r\n       \t\tredirect_to '/test' and return\r\n       \t\t# sign_in_and_redirect test_path and return\r\n        end\r\n      end\r\n    end\r\n\r\n\r\n    # break out provider attribute assignment for easy method extension\r\n    def assign_provider_attrs(user, auth_hash)\r\n      user.assign_attributes({\r\n         email: auth_hash['info']['email'],\r\n         name: auth_hash['info']['name'],\r\n         admin: true,\r\n         first_name: CustomRegex.japanese?(auth_hash['info'][\"first_name\"]) ? '' : auth_hash['info'][\"first_name\"],\r\n         last_name: CustomRegex.japanese?(auth_hash['info'][\"last_name\"]) ? '' : auth_hash['info'][\"last_name\"],\r\n         uqid: SecureRandom.uuid,\r\n         company_id: 1,\r\n         timeline: 0\r\n     \t})\r\n    end\r\n  end\r\nend\r\n```\r\n\r\nMy Gemfile\r\n\r\n```\r\ngem 'devise_token_auth'\r\ngem 'omniauth'\r\ngem 'omniauth-google-oauth2'\r\nruby '2.3.0'\r\nENV['NOKOGIRI_USE_SYSTEM_LIBRARIES'] = 'YES'\r\ngem 'rails', '4.2.6'\r\ngem 'rails-api', '~> 0.4.0'\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/lynndylanhurley/devise_token_auth/issues/comments/412250299","html_url":"https://github.com/lynndylanhurley/devise_token_auth/issues/1010#issuecomment-412250299","issue_url":"https://api.github.com/repos/lynndylanhurley/devise_token_auth/issues/1010","id":412250299,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMjI1MDI5OQ==","user":{"login":"el-rotny","id":2199827,"node_id":"MDQ6VXNlcjIxOTk4Mjc=","avatar_url":"https://avatars0.githubusercontent.com/u/2199827?v=4","gravatar_id":"","url":"https://api.github.com/users/el-rotny","html_url":"https://github.com/el-rotny","followers_url":"https://api.github.com/users/el-rotny/followers","following_url":"https://api.github.com/users/el-rotny/following{/other_user}","gists_url":"https://api.github.com/users/el-rotny/gists{/gist_id}","starred_url":"https://api.github.com/users/el-rotny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/el-rotny/subscriptions","organizations_url":"https://api.github.com/users/el-rotny/orgs","repos_url":"https://api.github.com/users/el-rotny/repos","events_url":"https://api.github.com/users/el-rotny/events{/privacy}","received_events_url":"https://api.github.com/users/el-rotny/received_events","type":"User","site_admin":false},"created_at":"2018-08-11T04:38:55Z","updated_at":"2018-08-11T04:38:55Z","author_association":"NONE","body":"Just in case someone needed to see how this is done on the client side. Posted a work around on redux-token-auth https://github.com/kylecorbelli/redux-token-auth/issues/28#issuecomment-412233112"}}
{"actor":{"display_login":"el-rotny"}}