jundalisay
Phoenix + Flutter: How to get the User ID from Access Token in Pow?
I’m new to user authentication via Phoenix API on Flutter Android.
I used Pow to make a user API which outputs renewal_token and access_token.
How can I use the access_token to get the user’s id so that I can make a GET request of his products in the API below?
Or is there a way to send the access token back to Phoenix to get the products of the user_id associated with that token?
final response = await dio.get('http://192.168.100.145:4000/api/products?userId=$userId');
ChatGPT is not yet updated on Pow.
Marked As Solved
jundalisay
I got stuck at trying to fetch user info from the Pow access token, so I switched to using Guardian ID token through this tutorial: https://www.youtube.com/watch?v=beW3yscX3ww and this repo https://github.com/ElixirMentor/real_deal_api/tree/main
After login, Flutter just gets the user’s account UUID then passes that around between Flutter widgets.
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
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex









