wordpress - Authenticate custom WP API endpoint with social login (OAuth) -


i'm using wordpress + woocommerce in combination wp-api backend mobile ecommerce app.

my goal offer social login (via facebook, twitter, google etc.) within app register/login , use woocommerce api receive e.g. orders of authenticated user.

currently plan is:

  1. use client sdk user e.g. can login using fb account
  2. from step 1 e.g. users name, email , fb id sent custom endpoint adding user wordpress db (like https://github.com/royboy789/wp-api-social-login)
  3. create custom endpoint orders wp-api (e.g.: .../orders)
  4. inside endpoint function check wether user authenticated
  5. if user authenticated, endpoint returns user's orders using woocommerce api wrapper (https://github.com/kloon/woocommerce-rest-api-client-library)

but i'm struggling @ #3 because don't know how check wether user authenticated.

i thought creating endpoint contact oauth authorization server check user’s credentials using e.g. facebook's access token. , if check valid, create custom access token api using hashing of userid, email etc. sent client app. access token used every call api reads out user id hashed token , returns e.g. orders user.

but somehow feels not right. because way i'd create endless living access token...


Comments

Popular posts from this blog

What Are The Best Universities In The World?

java - Solr query version issue: Invalid version or the data in not in 'javabin' format -

Hard vs. Soft Water: What's The Difference?