Reputation: 541
I'm developing application which need access to user's facebook account. It is working, but I need to get user's facebook token and save it to MySQL database. How can I get facebook token using PHP (with permissions defined by me) ?
Upvotes: 0
Views: 3368
Reputation: 164129
There's a good official guide/tutorial about just that in the facebook developers documentation. What you're looking for is the Server-Side authentication flow, since it results with a long lived access token (60 days) which you can persist in your db and reuse when needed.
There's also the Client-Side flow but that grants you short lived tokens (a few hours long) which are no good for persistancy. If however you do decide to go with the client side flow then you can extend the expiration time of a valid token using the new endpoint which was introcuded due to the deprecation of the offline_access permissions.
Upvotes: 2