Skip to content

OAuth having problems if a dot is an attribute in the Identity Path #13220

@Centzilius

Description

@Centzilius

Description:

When using Azure AD as OAuth2 provider and using https://graph.microsoft.com/v1.0/me/ as Identity Path you get the following error on log in (server log):

{"line":"392","file":"oauth_server.js","message":"Error in OAuth Server: Key @odata.context must not contain '.'","time":{"$date":1548170235154},"level":"warn"}
Exception while invoking method 'login' { MinimongoError: Key @odata.context must not contain '.'
    at MinimongoError (packages/minimongo/common.js:1087:17)
    at assertIsValidFieldName (packages/minimongo/local_collection.js:1889:11)
    at Object.JSON.stringify (packages/minimongo/local_collection.js:1880:7)
    at JSON.stringify (<anonymous>)
    at assertHasValidFieldNames (packages/minimongo/local_collection.js:1879:10)
    at Function.LocalCollection._modify (packages/minimongo/local_collection.js:1184:5)
    at Function.LocalCollection._createUpsertDocument (packages/minimongo/local_collection.js:935:19)
    at MongoConnection._update (packages/mongo/mongo_driver.js:546:38)
    at MongoConnection.<anonymous> (packages/meteor.js:376:21)
    at MongoConnection.(anonymous function) [as update] (packages/mongo/mongo_driver.js:754:49)
    at Collection.update (packages/mongo/collection.js:585:31)
    at Collection.upsert (packages/mongo/collection.js:655:17)
    at Object.OAuth._storePendingCredential (packages/oauth/pending_credentials.js:56:29)
    at OAuth._requestHandlers.(anonymous function) (packages/oauth2/oauth2_server.js:17:11)
    at middleware (packages/oauth/oauth_server.js:161:5)
    at /app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40
  message: 'Key @odata.context must not contain \'.\'',
  name: 'MinimongoError',
  futureStack: 'MinimongoError: Key @odata.context must not contain \'.\'\n    at MinimongoError (packages/minimongo/common.js:1087:17)\n    at assertIsValidFieldName (packages/minimongo/local_collection.js:1889:11)\n    at Object.JSON.stringify (packages/minimongo/local_collection.js:1880:7)\n    at JSON.stringify (<anonymous>)\n    at assertHasValidFieldNames (packages/minimongo/local_collection.js:1879:10)\n    at Function.LocalCollection._modify (packages/minimongo/local_collection.js:1184:5)\n    at Function.LocalCollection._createUpsertDocument (packages/minimongo/local_collection.js:935:19)\n    at MongoConnection._update (packages/mongo/mongo_driver.js:546:38)\n    at MongoConnection.<anonymous> (packages/meteor.js:376:21)\n    at MongoConnection.(anonymous function) [as update] (packages/mongo/mongo_driver.js:754:49)\n    at Collection.update (packages/mongo/collection.js:585:31)\n    at Collection.upsert (packages/mongo/collection.js:655:17)\n    at Object.OAuth._storePendingCredential (packages/oauth/pending_credentials.js:56:29)\n    at OAuth._requestHandlers.(anonymous function) (packages/oauth2/oauth2_server.js:17:11)\n    at middleware (packages/oauth/oauth_server.js:161:5)\n    at /app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40' }

The content of https://graph.microsoft.com/v1.0/me/ is the following:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users/$entity",
    "businessPhones": [
        "+49XXX"
    ],
    "displayName": "Vincent Post",
    "givenName": "Vincent",
    "jobTitle": "Support Engineer",
    "mail": "[email protected]",
    "mobilePhone": null,
    "officeLocation": "Universe, Galaxy",
    "preferredLanguage": null,
    "surname": "Post",
    "userPrincipalName": "[email protected]",
    "id": "b89de1d0-1e5c-11e9-b56e-0800200c9a66"
}

Server Setup Information:

  • Version of Rocket.Chat Server: 0.73.2
  • Operating System: CentOS 7
  • Deployment Method: docker
  • Number of Running Instances: 1
  • DB Replicaset Oplog: Disabled
  • NodeJS Version: 8.11.4 - x64
  • MongoDB Version: docker container mongo:3.2

This might be related to #10931

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions