Hi <@963922231224844359> , thanks you all for putt...
# general
y
Hi @rahul1 , thanks you all for putting this together. I tried to use oauth2/authorize endpoint to get the one time authorization code. I've registered the redirect uri with the client. But I am getting an invalid request error. Any ideas on this?
r
Are you sending in the
clientId
? Also, is there any info in the developer console about the reason for the error?
(assuming you're sending the call from the browser)
y
Yes, I included the client_id. Not really, other than invalid request, not much info in the developer console.
r
Do you mind copying the headers / body of your request here?
y
:authority: api.medplum.com :method: GET :path: /oauth2/authorize?response_type=code&client_id=992cb882-7e65-4385-aef6-36b7cd9d7b92&redirect_uri=OURREDIRECTURI&state=2022-08-25T14%3A10%3A59-07%3A00 :scheme: https accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9 accept-encoding: gzip, deflate, br accept-language: en-US,en;q=0.9 cookie: _ga=GA1.1.1571497015.1660070397; _ga_SHW0ZNT27G=GS1.1.1661461697.9.0.1661461699.0.0.0 sec-ch-ua: "Chromium";v="104", " Not A;Brand";v="99", "Google Chrome";v="104" sec-ch-ua-mobile: ?0 sec-ch-ua-platform: "macOS" sec-fetch-dest: document sec-fetch-mode: navigate sec-fetch-site: none sec-fetch-user: ?1 upgrade-insecure-requests: 1 user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36
r
Takign a look now
y
Would it be related to this "Referrer Policy: strict-origin-when-cross-origin"?
r
Yes it could be. Were you able to clone our demo application and add your clientId there to test on localhost:8000?
I was able to test with your clientId using an HTTP Client (insomnia), and i got a response back jsut fine
y
No, I haven't. Could you send me the link to the doc that instruct me how to create the demo application? I can try it now.
r
It should just be in the README of the github repository I linked earlier https://github.com/medplum/medplum-oauth-demo
You'll just have to change the client_id in the
index.html
page
Actually, nvm, I just had a typo. With the demo app, I'm able to login and get redirected to `https://YOUR_REDIRECT_URI/?scope=openid&code=CODE
it seems like your URI is not publicly accessible, since I can't access it in the browser
y
That makes sense. I will check with our senior engineer and see if there is some domain restriction
r
Are you able to see the same redirection as I am?
y
Not really. I tried to use the localhost (follow the instruction) and I got the same error.
r
is the error still
invalid redirect_uri
?
y
the error is still Incorrect redirect_uri
Hi Raful
r
hello
Is there any way you could send me the file
index.html
in your demo? I'll try running on my end and see debug
if you'd prefer, you can email it to me at rahul@medplum.com
y
You need the page that opens in http://localhost:3000/ after sign in, right?
The last update: looks like I go through some flow but I am on blank page
redirect me to localhost:3000
home page
r
Hmm, I just want to make sure we're talking about the same thing. To confirm: - You cloned this repo: https://github.com/medplum/medplum-oauth-demo - Edited index.html with your
clientId
and
redirect_uri
on lines 17 and 18 of index.html - You used
npx http-server ./ -p 8000
to run the demo?
y
Thanks for following up with us on this. Yeah, I did change the clientId on line 17 but I keep the redirect_uri as it is 'http://localhost:8000/' so I can test the localhost first.
After that I got this page and the invalid-request error
r
Which server are you testing against? The Medplum hosted service, or the medplum server on your localhost?
ie. what is the baseUrl you are using on line 23 of index.html?
r
Would you guy have time for a quick call? This might be easier with a screenshare
y
The Medplum hosted service I believe
y
I've sent the index.html page by email to you
y
Right, @rahul1 , it might be easier for us to quick sync. Would you be available tomorrow morning at 10:00 or 10:30?
r
I think I see the issue. Is it ok f I post the redirect_uri here? Or is it sensitive/
The problem is that you index.html has a redirect_uri that is doesn't match what you have configured in your client application
I see a
localhost:port
in your client application, but a different url in your index.html
they need to match exactly (including trailing slashes, etc.)
y
could you please send the correct config with replying on my email?
y
I just changed to the one you have in the request, @yury.starav
I will also test that redirect uri instead of local host.
r
@Yaxuan.Zhang @yury.starav I just responded to the email
Why don't you give the changes in my email a try. if they're still not working, I can meet around this time
y
Hi @rahul1 , @yury.starav and I tried but it looks like it is still not working for us. Let's meet at 10:30 if it still works for you. Sent you an invitation. Feel free to let me know if you prefer another time.
r
Actually I have a Dentist appointment at 11am, so it might be a bit tight. Is there some time after noon we could meet?
y
Yeah, for sure. We probably don't have time between 2-4, could you share with me some time works for you other than 2-4pm?
1 pm might be more preferred for us.
If that works for you.
r
Yes, 1pm works for me
y
Great! let'd do 1pm
r
@Yaxuan.Zhang @yury.starav Just summarizing our findings from the call: 1. The browser was aggressively caching the
index.html
in our demo application, which meant that changes to the
redirect_uri
were not being reflected in the browser. Switching to incognito mode fixed this 2. For some reason, the
User
that was created via Foo Medical registration was not being configured to your project correctly. I will follow up on this issue ASAP
y
Thank you for the summary, @rahul1 !
r
@Yaxuan.Zhang I'm in the process of debugging your patient login. It turns out your patient DID get created successfully as a user, I was just looking at the wrong Tab. You can see your Test2 FooMedical patient here: https://app.medplum.com/admin/patients
I was able to successfully login to a Patient I created in your Foo Medical, called "Rahul Test1". I'd also like to test the flow with your patient called "Test2 FooMedical" - would it be ok to share the pw for that account with me over email?
Also, which foo-medical on vercel were you using to create the patient? I see a few options
y
Thanks @rahul1 ! I actually forgot which foo medical on vercel I used to create that account. I created another one. I will email you the pw and url.
r
Thanks @Yaxuan.Zhang - I'll get back to you by EOD
@Yaxuan.Zhang - I just sent you an email with a video of my login with your new patient. Let me know if you're still having trouble
180 Views