danschultzer / phoenix_oauth2_provider

Get an OAuth 2 provider running in your phoenix with controllers, views and models in just two minutes
MIT License
84 stars 41 forks source link

Question #17

Closed chasers closed 5 years ago

chasers commented 5 years ago

Was wiring this up and #15 helped quite a bit since I'm in Phoenix 1.4.

Got pretty far but have a question. I'm using this for https://github.com/Logflare/logflare which ultimately needs a Cloudflare app. I need to be an Oauth2 server for that. I got to the point where I can request authorization and it sends me back to Cloudflare. Then Cloudflare calls this https://github.com/danschultzer/ex_oauth2_provider#authorization-code-grant but the client-secret is passed as basic auth in the header it looks like. You can see that request here: https://cl.ly/a211d29e3a9a/Screen%20Shot%202019-02-12%20at%2010.23.01%20AM.png

Is that something I'll be able to work around with this library or should I go another route?

Thanks!!

niccolox commented 5 years ago

glad its not just me

danschultzer commented 5 years ago

You can ignore client secret, by setting it to an empty string. I’m not completely sure how the cloudflare app works, but sounds like you will manage both sides so client secret isn’t necessary.

chasers commented 5 years ago

Gotcha ... thanks for being so responsive here btw.

Looks like I was able to get it to issue me an access token but when I made the request I actually had to use "" for the client_secret. When I did that it worked. When I don't do that it doesn't seem to find it in the database.

https://cl.ly/e3a371948744/Screen%20Shot%202019-02-12%20at%2011.26.15%20AM.png https://cl.ly/7148a50202c9/Screen%20Shot%202019-02-12%20at%2011.31.24%20AM.png

danschultzer commented 5 years ago

Is that an empty value or is it actually ""? It should just be completely empty, and it should work.

chasers commented 5 years ago

Yep you're right ... and holy sh*t it worked!

screen shot 2019-02-12 at 12 07 51 pm