# Custom OAuth "No Matching login attempt found"

**URL:** <https://forums.rocket.chat/t/custom-oauth-no-matching-login-attempt-found/11353>\
**Category:** Development\
**Tags:** rocketchat-apps\
**Created:** [June 7, 2021, 5:19pm UTC](https://forums.rocket.chat/t/custom-oauth-no-matching-login-attempt-found/11353 "2021-06-07T17:19:56Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![joelchittum](https://avatars.discourse-cdn.com/v4/letter/j/e19adc/32.png) [@joelchittum](https://forums.rocket.chat/u/joelchittum)\
**Post date:** [June 7, 2021, 5:19pm UTC](https://forums.rocket.chat/t/custom-oauth-no-matching-login-attempt-found/11353/1 "2021-06-07T17:19:56Z")

</div>

I am trying to setup a custom oauth solution and I am getting a “No matching login attempt found”. The logs from the rocketchat container are: Meteor ➔ method public-settings/get → userId: undefined, arguments: [{}]  
API ➔ debug Success {  
statusCode: 200,  
body: {  
message: ‘{“msg”:“result”,“id”:“3”,“result”:{“update”:,“remove”:}}’,  
success: true  
}  
}  
API ➔ debug POST: /api/v1/method.callAnon/login  
Exception while invoking method login Error: No matching login attempt found [145546287]  
at MethodInvocation. (packages/accounts-oauth/oauth\_server.js:35:21)  
at packages/accounts-base/accounts\_server.js:499:31  
at tryLoginMethod (packages/accounts-base/accounts\_server.js:1341:14)  
at AccountsServer.\_runLoginHandlers (packages/accounts-base/accounts\_server.js:497:22)  
at AccountsServer.Accounts.\_runLoginHandlers (app/lib/server/lib/loginErrorMessageOverride.js:7:35)  
at MethodInvocation.methods.login (packages/accounts-base/accounts\_server.js:557:31)  
at maybeAuditArgumentChecks (packages/ddp-server/livedata\_server.js:1771:12)  
at packages/ddp-server/livedata\_server.js:1689:15  
at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12)  
at packages/ddp-server/livedata\_server.js:1687:36  
at new Promise ()  
at Server.applyAsync (packages/ddp-server/livedata\_server.js:1686:12)  
at Server.apply (packages/ddp-server/livedata\_server.js:1625:26)  
at Server.call (packages/ddp-server/livedata\_server.js:1607:17)  
at Object.post (app/api/server/v1/misc.js:263:26)  
at app/api/server/api.js:394:82  
at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12)  
at Object.\_internalRouteActionHandler [as action] (app/api/server/api.js:394:39)  
at Route.share.Route.Route.\_callEndpoint (packages/nimble\_restivus/lib/route.coffee:150:32)  
at packages/nimble\_restivus/lib/route.coffee:59:33  
at packages/simple\_json-routes.js:98:9  
=\> awaited here:  
at Promise.await (/app/bundle/programs/server/npm/node\_modules/meteor/promise/node\_modules/meteor-promise/promise\_server.js:60:12)  
at Server.apply (packages/ddp-server/livedata\_server.js:1638:22)  
at Server.call (packages/ddp-server/livedata\_server.js:1607:17)  
at Object.post (app/api/server/v1/misc.js:263:26)  
at app/api/server/api.js:394:82  
at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12)  
at Object.\_internalRouteActionHandler [as action] (app/api/server/api.js:394:39)  
at Route.share.Route.Route.\_callEndpoint (packages/nimble\_restivus/lib/route.coffee:150:32)  
at packages/nimble\_restivus/lib/route.coffee:59:33  
at packages/simple\_json-routes.js:98:9  
API ➔ debug Success {  
statusCode: 200,  
body: {  
message: ‘{“msg”:“result”,“id”:“4”,“error”:{“isClientSafe”:true,“error”:145546287,“reason”:“No matching login attempt found”,“message”:“No matching login attempt found [145546287]”,“errorType”:“Meteor.Error”}}’,  
success: true  
}  
}

I am curious if there is an way of finding more information about the error so I can diagnose what is happening.

---

<div class="post-metadata">

**Author:** ![john.crisp](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/john.crisp/32/2711_2.png) [@john.crisp](https://forums.rocket.chat/u/john.crisp)\
**Post date:** [June 8, 2021, 9:26am UTC](https://forums.rocket.chat/t/custom-oauth-no-matching-login-attempt-found/11353/2 "2021-06-08T09:26:43Z")

</div>

Hi.

Can you be a bit more descriptive on how you are setting this up please?

Have a read of this for how to report issues effectively.

> <https://gist.github.com/reetp/a66149d5f060f260643a353ca7067a98>

---

<div class="post-metadata">

**Author:** ![joelchittum](https://avatars.discourse-cdn.com/v4/letter/j/e19adc/32.png) [@joelchittum](https://forums.rocket.chat/u/joelchittum)\
**Post date:** [June 8, 2021, 2:43pm UTC](https://forums.rocket.chat/t/custom-oauth-no-matching-login-attempt-found/11353/3 "2021-06-08T14:43:22Z")

</div>

Server Hardware: Docker container  
Version of Rocket.Chat Server: 3.15.0  
Operating System: Docker container  
Deployment Method: docker  
Number of Running Instances: 1  
DB Replicaset Oplog: mongodb://mongo:27017/local  
NodeJS Version: 12.22.1 - x64  
MongoDB Version: 4.0.24

Client Type: Browser Chrome 91.0.4472.77 (64-bit)

Setup new Rocketchat docker container enable custom oauth provider and try to login with confirmed good user name. After which the error that is given is “No matching login attempt found”. Is there a error log that I can check to find more information about what is going wrong.

---

<div class="post-metadata">

**Author:** ![john.crisp](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/john.crisp/32/2711_2.png) [@john.crisp](https://forums.rocket.chat/u/john.crisp)\
**Post date:** [June 8, 2021, 5:40pm UTC](https://forums.rocket.chat/t/custom-oauth-no-matching-login-attempt-found/11353/4 "2021-06-08T17:40:17Z")

</div>

You can first set the log level in Rocket and check the logs there, or via the CLI:

`docker logs -f <container>`

Have you tried just using the curl commands in the API docs?

What did that show?

---

<div class="post-metadata">

**Author:** ![joelchittum](https://avatars.discourse-cdn.com/v4/letter/j/e19adc/32.png) [@joelchittum](https://forums.rocket.chat/u/joelchittum)\
**Post date:** [June 9, 2021, 8:44pm UTC](https://forums.rocket.chat/t/custom-oauth-no-matching-login-attempt-found/11353/5 "2021-06-09T20:44:11Z")

</div>

How do I change the log level. I have not found that option in Rocket UI. And I do not know the command line switch that I need.

---

<div class="post-metadata">

**Author:** ![john.crisp](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/john.crisp/32/2711_2.png) [@john.crisp](https://forums.rocket.chat/u/john.crisp)\
**Post date:** [June 10, 2021, 8:32am UTC](https://forums.rocket.chat/t/custom-oauth-no-matching-login-attempt-found/11353/6 "2021-06-10T08:32:59Z")

</div>

Look in Admin, Logs.

 ![Screenshot 2021-06-10 at 10.29.35](https://us1.discourse-cdn.com/flex021/uploads/rocketchat/original/2X/5/59cb8e8c2e9ce431a4f7d6b0bf8b3c17b202cdb5.png)

---

<div class="post-metadata">

**Author:** ![joelchittum](https://avatars.discourse-cdn.com/v4/letter/j/e19adc/32.png) [@joelchittum](https://forums.rocket.chat/u/joelchittum)\
**Post date:** [June 18, 2021, 6:07pm UTC](https://forums.rocket.chat/t/custom-oauth-no-matching-login-attempt-found/11353/7 "2021-06-18T18:07:33Z")

</div>

After more testing with my oauth provider and increasing the log level in rocketchat I am getting this error.

{“line”:“69”,“file”:“oauth\_server.js”,“message”:“Unable to base64 decode state from OAuth query: undefined”,“time”:{"$date":1624039466464},“level”:“warn”}  
{“line”:“69”,“file”:“oauth\_server.js”,“message”:“Unable to base64 decode state from OAuth query: undefined”,“time”:{"$date":1624039466465},“level”:“warn”}  
server.js:204 API ➔ debug POST: /api/v1/method.callAnon/login  
Failed login detected - Username[unknown] ClientAddress[10.255.0.2] ForwardedFor[10.255.0.2] XRealIp[undefined] UserAgent[Mozilla/5.0 (X11; Linux x86\_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36]  
Exception while invoking method login Error: No matching login attempt found [145546287]  
at MethodInvocation. (packages/accounts-oauth/oauth\_server.js:35:21)  
at packages/accounts-base/accounts\_server.js:499:31  
at tryLoginMethod (packages/accounts-base/accounts\_server.js:1341:14)  
at AccountsServer.\_runLoginHandlers (packages/accounts-base/accounts\_server.js:497:22)  
at AccountsServer.Accounts.\_runLoginHandlers (app/lib/server/lib/loginErrorMessageOverride.js:7:35)  
at MethodInvocation.methods.login (packages/accounts-base/accounts\_server.js:557:31)  
at maybeAuditArgumentChecks (packages/ddp-server/livedata\_server.js:1771:12)  
at packages/ddp-server/livedata\_server.js:1689:15  
at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12)  
at packages/ddp-server/livedata\_server.js:1687:36  
at new Promise ()  
at Server.applyAsync (packages/ddp-server/livedata\_server.js:1686:12)  
at Server.apply (packages/ddp-server/livedata\_server.js:1625:26)  
at Server.call (packages/ddp-server/livedata\_server.js:1607:17)  
at Object.post (app/api/server/v1/misc.js:263:26)  
at app/api/server/api.js:394:82  
at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12)  
at Object.\_internalRouteActionHandler [as action] (app/api/server/api.js:394:39)  
at Route.share.Route.Route.\_callEndpoint (packages/nimble\_restivus/lib/route.coffee:150:32)  
at packages/nimble\_restivus/lib/route.coffee:59:33  
at packages/simple\_json-routes.js:98:9  
=\> awaited here:  
at Promise.await (/app/bundle/programs/server/npm/node\_modules/meteor/promise/node\_modules/meteor-promise/promise\_server.js:60:12)  
at Server.apply (packages/ddp-server/livedata\_server.js:1638:22)  
at Server.call (packages/ddp-server/livedata\_server.js:1607:17)  
at Object.post (app/api/server/v1/misc.js:263:26)  
at app/api/server/api.js:394:82  
at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12)  
at Object.\_internalRouteActionHandler [as action] (app/api/server/api.js:394:39)  
at Route.share.Route.Route.\_callEndpoint (packages/nimble\_restivus/lib/route.coffee:150:32)  
at packages/nimble\_restivus/lib/route.coffee:59:33  
at packages/simple\_json-routes.js:98:9  
server.js:204 API ➔ debug Success {  
statusCode: 200,  
body: {  
message: ‘{“msg”:“result”,“id”:“14”,“error”:{“isClientSafe”:true,“error”:145546287,“reason”:“No matching login attempt found”,“message”:“No matching login attempt found [145546287]”,“errorType”:“Meteor.Error”}}’,  
success: true  
}  
}

Is the oauth provider supposed to return the state value to rocktechat with the authorization code or am I misunderstanding this error log?

---

<div class="post-metadata">

**Author:** ![joelchittum](https://avatars.discourse-cdn.com/v4/letter/j/e19adc/32.png) [@joelchittum](https://forums.rocket.chat/u/joelchittum)\
**Post date:** [July 1, 2021, 9:14pm UTC](https://forums.rocket.chat/t/custom-oauth-no-matching-login-attempt-found/11353/8 "2021-07-01T21:14:21Z")

</div>

So additional information I have gotten from the logs in rocketchat has to do with the OAuth handshake.

Error: Failed to complete OAuth handshake with edxoauth at [https://edx.centos-vm/oauth/token](https://edx.centos-vm/oauth/token). getaddrinfo ENOTFOUND edx.centos-vm  
at CustomOAuth.getAccessToken (app/custom-oauth/server/custom\_oauth\_server.js:148:18)  
at Object.handleOauthRequest (app/custom-oauth/server/custom\_oauth\_server.js:205:26)  
at OAuth.\_requestHandlers. (packages/oauth2/oauth2\_server.js:10:33)  
at middleware (packages/oauth/oauth\_server.js:170:5)  
at /app/bundle/programs/server/npm/node\_modules/meteor/promise/node\_modules/meteor-promise/fiber\_pool.js:43:40  
=\> awaited here:  
at Promise.await (/app/bundle/programs/server/npm/node\_modules/meteor/promise/node\_modules/meteor-promise/promise\_server.js:60:12)  
at Server.apply (packages/ddp-server/livedata\_server.js:1638:22)  
at Server.call (packages/ddp-server/livedata\_server.js:1607:17)  
at Object.post (app/api/server/v1/misc.js:263:26)  
at app/api/server/api.js:394:82  
at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12)  
at Object.\_internalRouteActionHandler [as action] (app/api/server/api.js:394:39)  
at Route.share.Route.Route.\_callEndpoint (packages/nimble\_restivus/lib/route.coffee:150:32)  
at packages/nimble\_restivus/lib/route.coffee:59:33  
at packages/simple\_json-routes.js:98:9

---

<div class="post-metadata">

**Author:** ![john.crisp](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/john.crisp/32/2711_2.png) [@john.crisp](https://forums.rocket.chat/u/john.crisp)\
**Post date:** [July 2, 2021, 3:49pm UTC](https://forums.rocket.chat/t/custom-oauth-no-matching-login-attempt-found/11353/9 "2021-07-02T15:49:59Z")

</div>

This domain is invlaid.

> getaddrinfo ENOTFOUND edx.centos-vm

Please check this link

`https://edx.centos-vm/oauth/token`

---

<div class="post-metadata">

**Author:** ![joelchittum](https://avatars.discourse-cdn.com/v4/letter/j/e19adc/32.png) [@joelchittum](https://forums.rocket.chat/u/joelchittum)\
**Post date:** [July 2, 2021, 3:53pm UTC](https://forums.rocket.chat/t/custom-oauth-no-matching-login-attempt-found/11353/10 "2021-07-02T15:53:26Z")

</div>

This is a local domain it is not on the internet but it is valid in my setup.

---

<div class="post-metadata">

**Author:** ![john.crisp](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/john.crisp/32/2711_2.png) [@john.crisp](https://forums.rocket.chat/u/john.crisp)\
**Post date:** [July 2, 2021, 3:55pm UTC](https://forums.rocket.chat/t/custom-oauth-no-matching-login-attempt-found/11353/11 "2021-07-02T15:55:56Z")

</div>

It doesn’t resolve though, hence this error.

> getaddrinfo ENOTFOUND edx.centos-vm

---

<div class="post-metadata">

**Author:** ![joelchittum](https://avatars.discourse-cdn.com/v4/letter/j/e19adc/32.png) [@joelchittum](https://forums.rocket.chat/u/joelchittum)\
**Post date:** [July 2, 2021, 3:56pm UTC](https://forums.rocket.chat/t/custom-oauth-no-matching-login-attempt-found/11353/12 "2021-07-02T15:56:25Z")

</div>

Ohok sorry i see what you are saying now thanks for the help.

---

<div class="post-metadata">

**Author:** ![john.crisp](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/john.crisp/32/2711_2.png) [@john.crisp](https://forums.rocket.chat/u/john.crisp)\
**Post date:** [July 2, 2021, 4:00pm UTC](https://forums.rocket.chat/t/custom-oauth-no-matching-login-attempt-found/11353/13 "2021-07-02T16:00:48Z")

</div>

If that solves your issue please mark it as solved!!

Thanks.

---

<div class="post-metadata">

**Author:** ![joelchittum](https://avatars.discourse-cdn.com/v4/letter/j/e19adc/32.png) [@joelchittum](https://forums.rocket.chat/u/joelchittum)\
**Post date:** [July 8, 2021, 2:35pm UTC](https://forums.rocket.chat/t/custom-oauth-no-matching-login-attempt-found/11353/14 "2021-07-08T14:35:10Z")

</div>

This issue seems to be related to my setup being containers on the same domain and rocketchat not being able to resolve the oauth2 container is there a setting within rocketchat that I am missing to get rocketchat to resolve other containers with the swarm.

---

<div class="post-metadata">

**Author:** ![john.crisp](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/john.crisp/32/2711_2.png) [@john.crisp](https://forums.rocket.chat/u/john.crisp)\
**Post date:** [July 9, 2021, 8:53am UTC](https://forums.rocket.chat/t/custom-oauth-no-matching-login-attempt-found/11353/15 "2021-07-09T08:53:10Z")

</div>

OK, you failed to mention this setup earlier…

> Number of Running Instances: 1

But in actual fact you have a cluster?

You need to give us full details of your setup. Are you using HA Proxy and sticky sessions etc?

---

<div class="post-metadata">

**Author:** ![joelchittum](https://avatars.discourse-cdn.com/v4/letter/j/e19adc/32.png) [@joelchittum](https://forums.rocket.chat/u/joelchittum)\
**Post date:** [July 9, 2021, 11:41am UTC](https://forums.rocket.chat/t/custom-oauth-no-matching-login-attempt-found/11353/16 "2021-07-09T11:41:26Z")

</div>

I am not using sticky sessions but I am using apache to direct all of my traffic. I only have one rocketchat container running I have not set up any more than that. The oauth server is a container that is running on the same network and the same machine as the rocktechat container. I am able to ping the apache container from the rocketchat container and vis versa via the container names.

---

<div class="post-metadata">

**Author:** ![john.crisp](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/john.crisp/32/2711_2.png) [@john.crisp](https://forums.rocket.chat/u/john.crisp)\
**Post date:** [July 12, 2021, 10:08am UTC](https://forums.rocket.chat/t/custom-oauth-no-matching-login-attempt-found/11353/17 "2021-07-12T10:08:34Z")

</div>

I think you need to test pinging from inside each container to another container.

A bit like this, and then ping from there.

`docker exec -it <container name> /bin/bash`

---

<div class="post-metadata">

**Author:** ![joelchittum](https://avatars.discourse-cdn.com/v4/letter/j/e19adc/32.png) [@joelchittum](https://forums.rocket.chat/u/joelchittum)\
**Post date:** [July 12, 2021, 10:47am UTC](https://forums.rocket.chat/t/custom-oauth-no-matching-login-attempt-found/11353/18 "2021-07-12T10:47:57Z")

</div>

That is how I was testing the ping from inside of the rocketchat container to the apache container and it works fine and I also tested ping from inside the apache container to the rocktechat container and it works just fine as well

---

<div class="post-metadata">

**Author:** ![joelchittum](https://avatars.discourse-cdn.com/v4/letter/j/e19adc/32.png) [@joelchittum](https://forums.rocket.chat/u/joelchittum)\
**Post date:** [July 14, 2021, 2:59pm UTC](https://forums.rocket.chat/t/custom-oauth-no-matching-login-attempt-found/11353/19 "2021-07-14T14:59:15Z")

</div>

The fix for this particular issue is to use the oauth docker container name for the token endpoint that needs to be connected to.

---

<div class="post-metadata">

**Author:** ![john.crisp](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/john.crisp/32/2711_2.png) [@john.crisp](https://forums.rocket.chat/u/john.crisp)\
**Post date:** [July 14, 2021, 4:23pm UTC](https://forums.rocket.chat/t/custom-oauth-no-matching-login-attempt-found/11353/20 "2021-07-14T16:23:40Z")

</div>

Cool! I presume docker knows the internal IP for this.

Can you post some samples of how you did this for others please?

Thanks.

[Next page](https://forums.rocket.chat/t/custom-oauth-no-matching-login-attempt-found/11353.md?page=2)
