1

This seems to be on a very new topic because the "stitch" or "mongodb-stitch" tags do not exist yet.

I have a mongodb altas cluster on cloud.mongodb.com. The page https://docs.mongodb.com/stitch/auth/email-auth/ only teaches how to do things with JS but I don't have server side JS on hand. Instead I tried to figure out how to do things with the StitchClient on the Android API.

I was able to register an email/password pair using StitchClient.register(email,pwd) and got an email from no-reply+stitch@mongodb.com with the token/tokenId. I copied them and used StitchClient.emailConfirm(token, tokenId) but failed. The error was:

Unexpected response code 404 for https://stitch.mongodb.com/api/client/v1.0/app/APP-ID/auth/local/userpass/confirm 

which sounds strange! I opened a browser and paste that in the URL and got 404 too. I even did

curl --data "token=432...345&tokenId=435..334" https://stitch.mongodb.com/api/client/v1.0/app/APP-ID/auth/local/userpass/confirm

and still got 404.

Is this a bug or an outage of the stitch.mongodb.com server?

Mehmet K
  • 2,805
  • 1
  • 23
  • 35
cpliu338
  • 645
  • 1
  • 7
  • 20
  • Tag added. Synopsis coming. – Neil Lunn Nov 17 '17 at 08:13
  • Service seems to be working as far as I can see. Not sure where you are getting that URL from. There is actually a "Getting Started" section on the console for any App you create with Stitch. This has a section with "Execute a Test Request" in which you can basically get generated code for 4 different platforms for a complete test application. There's also a [number of guides](https://docs.mongodb.com/stitch/tutorials/). But the "first" thing you should be doing is following that "Execute a Test Request" code and running that. Then you can start playing with other things. – Neil Lunn Nov 17 '17 at 08:36
  • I have "Executed a test request" all right. In fact I could do StitchClient.register(email,pwd) several times, but only failed when I ran StitchClient.emailConfirm(). From hindsight I noticed that the android client I am using has logged in anonymously. I do not know whether such a user has the privilege to confirm an email/user. The URL I got it from the android log spit out as an Exception for the 404 response. – cpliu338 Nov 17 '17 at 08:53
  • Sounds more like you still need to read some more guides. [Email/Password Authentication is described in the manual](https://docs.mongodb.com/stitch/auth/email-auth/). And generally requires a callback URL in your own hosted application, allowing a client to open a browser and enter, then redirect. You probably want ["Custom Authentication"](https://docs.mongodb.com/stitch/auth/custom-auth/). Questions here really should have more complete code at least following the guides in a way that can be reproduced. The "how to's" are essentially in the documentation. – Neil Lunn Nov 17 '17 at 09:06
  • I have tried to use "my own hosted application" and got a 400 response. I'll post my findings as another question (php code involved) when I have a more convenient computer with me. – cpliu338 Nov 17 '17 at 10:09
  • I was able to use JS now but still have problems, which is given in https://stackoverflow.com/questions/47352830/expired-token-for-email-password-authentication-using-mongodb-stitch-js-api – cpliu338 Nov 17 '17 at 14:24

0 Answers0