andreaswillems
Authenticate with external API in Phoenix 1.8.1 / LiveView 1.1.16
Hi everybody,
I have setup a Phoenix application using phx.gen.auth and LiveView.
I want to call an external API that is protected via OAuth2. So, after logging in, in a LiveView the user can choose to authorize with the external service, which is implemented as a redirect to the authorization URL. After login at the service and approving the usage, the service calls my callback URL with the authorization code. With the code, I want to exchange it into the access token and refresh token, store the tokens and redirect to the previous LiveView.
Unfortunately, I can not get this to work. After the redirect, I receive the callback, but my LV session is void and the user is basically logged out.
After searching the web and the forum I tried storing a session via a regular controller and also tried playing around with some JS trickery, but to no avail.
Could anybody please point me into the right direction?
Thanks in advance and have a good night.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









