Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Merge requests
  • !7141

Merged
Created Jun 17, 2014 by Administrator@rootOwner

Ensure that uid in OAuth is a string

  • Overview 6
  • Commits 1
  • Changes 1

Created by: katafrakt

In our company we use Redmine as OAuth provider (with https://github.com/suer/redmine_oauth_provider and https://github.com/suer/omniauth-redmine on GitLab side). In this case uid returned from Redmine is its database ID as integer. This leads to:

PG::Error: ERROR:  operator does not exist: character varying = integer
LINE 1: ..."."provider" = 'redmine' AND "users"."extern_uid" = 422  ORD...
                                                             ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
: SELECT  "users".* FROM "users"  WHERE "users"."provider" = 'redmine' AND "users"."extern_uid" = 422  ORDER BY "users"."id" DESC LIMIT 1
Completed 500 Internal Server Error in 27ms

ActiveRecord::StatementInvalid (PG::Error: ERROR:  operator does not exist: character varying = integer
LINE 1: ..."."provider" = 'redmine' AND "users"."extern_uid" = 422  ORD...
                                                             ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
: SELECT  "users".* FROM "users"  WHERE "users"."provider" = 'redmine' AND "users"."extern_uid" = 422  ORDER BY "users"."id" DESC LIMIT 1):
  lib/gitlab/oauth/user.rb:56:in `find_by_uid_and_provider'
  lib/gitlab/oauth/user.rb:14:in `find'
  app/controllers/omniauth_callbacks_controller.rb:36:in `handle_omniauth'
  app/controllers/omniauth_callbacks_controller.rb:4:in `block (2 levels) in <class:OmniauthCallbacksController>'
  app/controllers/application_controller.rb:59:in `set_current_user_for_thread'

Casting uid to string fixes this issue.

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: github/fork/PuzzleFlow/uid_should_always_be_string