-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
undefined method `match' for nil:NilClass #201
Comments
What is the value of |
i got nil at omniauth_params['auth_origin_url'] so the url is nil too |
So the question is, why is |
neither, I'm doing requests from the browser's adress bar |
I have the same issue, And no current_user. I'm using ng-token-auth |
I got same issue here, I using omniauth facebook the @auth_origin_url variable is used by omniauth_response.html.erb for redirecting user, so I though this solution is not perfect @auth_origin_url = generate_url(omniauth_params['auth_origin_url'], {
token: @token,
client_id: @client_id,
uid: @resource.uid,
expiry: @expiry
})
# set crazy password for new oauth users. this is only used to prevent
# access via email sign-in.
unless @resource.id
p = SecureRandom.urlsafe_base64(nil, false)
@resource.password = p
@resource.password_confirmation = p
end
@resource.tokens[@client_id] = {
token: BCrypt::Password.create(@token),
expiry: @expiry
}
# sync user info with provider, update/generate auth token
assign_provider_attrs(@resource, auth_hash)
# assign any additional (whitelisted) attributes
extra_params = whitelisted_params
@resource.assign_attributes(extra_params) if extra_params
# don't send confirmation email!!!
@resource.skip_confirmation!
sign_in(:user, @resource, store: false, bypass: false)
@resource.save!
# render user info to javascript postMessage communication window
respond_to do |format|
format.html { render :layout => "omniauth_response", :template => "devise_token_auth/omniauth_success" }
end so I thought it's safe to change generate_url method like this: BEFORE def generate_url(url, params = {})
auth_url = url
# ensure that hash-bang is present BEFORE querystring for angularjs
unless url.match(/#/)
auth_url += '#'
end
# add query AFTER hash-bang
auth_url += "?#{params.to_query}"
return auth_url
end AFTER def generate_url(url, params = {})
url = '' if url.nil?
auth_url = url
# ensure that hash-bang is present BEFORE querystring for angularjs
unless url.match(/#/)
auth_url += '#'
end
# add query AFTER hash-bang
auth_url += "?#{params.to_query}"
return auth_url
end I only tested this on facebook provider, I don't know with the others |
I don't understand the use-case where |
devise_token_auth (0.1.31) app/controllers/devise_token_auth/omniauth_callbacks_controller.rb:161:in `generate_url'
how can i fix this error?
The text was updated successfully, but these errors were encountered: