access-token

How to know if Access Token expires in Google Api PHP

做~自己de王妃 提交于 2019-12-21 06:05:05
问题 How will I know if my access token has expired. I'm using try and catch try { $result = file_get_contents('https://www.googleapis.com/calendar/v3/calendars/primary/events?access_token='.$accesstoken); print_r($result); } catch(Exception $e){ echo "Get new token"; } but still it gets error from the file_get_contents then prints "Get new token" If I want to use curl $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,'https://www.googleapis.com/calendar/v3/calendars/primary/events?access_token='.

Extend auth token without refreshing the page

霸气de小男生 提交于 2019-12-21 06:02:11
问题 Users want to use my facebook app for many hours without refreshing the browser. But token expires in 2 hours. Now I ask users to refresh the page but that's annoying. I don't want to ask offline access permissions because it will scare some users. The best solution will be somehow "relogin" and get new token without refreshing the page. Is it possible? 回答1: I would subscribe to the expiry trigger (I think this is authResponseChange), then automate another login check. It won't be a perfect

Restore Access Token in hybridauth

元气小坏坏 提交于 2019-12-21 05:57:10
问题 I saved the Access Token (using this method: getAccessToken ()) in my database, but now I would like to restore this value to an object. How can I do this? 回答1: This is explained in hybridauth user manual with below code : // get the stored hybridauth data from your storage system $hybridauth_session_data = get_sorted_hybridauth_session( $current_user_id ); Get_sorted_hybridauth_session is your internal function to get the stored data. It doesnt matter whether you store the data in a table in

How to post to a Facebook Page (how to get page access token + user access token)

▼魔方 西西 提交于 2019-12-21 05:43:07
问题 I am trying to work out how to post to a Facebook page wall, when using my app as a different Facebook User (who is not the Page Administrator). I get a range of error messages while testing: Exception: 200: The user hasn't authorized the application to perform this action The page administrator has visited the app and accepted the following permissions: publish_stream, manage_pages, offline_access Here is the code I plan to use: // Insert Page Administrators ID here // This user is not the

If I enable migrations “July 2013 Breaking Changes” of my app, then search user by email wouldn't work

戏子无情 提交于 2019-12-21 05:31:18
问题 I'm using the search graph API to search for users by email. Here's an example of how I do that: GET https://graph.facebook.com/search?q=Sample%40gmail.com&fields=name%2clink%2ceducation%2cid%2cwork%2cabout%2cpicture&limit=2&type=user&access_token=... Before the July 2013 Breaking Changes it was working fine. Once I enabled the breaking changes I start getting HTTP 403 saying that that the access token is not valid. HTTP/1.1 403 Forbidden Access-Control-Allow-Origin: * Cache-Control: no-store

Facebook Access Tokens - Server-Side Authentication

本秂侑毒 提交于 2019-12-21 04:28:15
问题 Hello i'm trying to use facebook server-side authenticaion to get the access token but keep getting errors thrown at me. I am using the bellow: $app_id = "YOUR_APP_ID"; $app_secret = "YOUR_APP_SECRET"; $my_url = "YOUR_URL"; session_start(); $code = $_REQUEST["code"]; if(empty($code)) { $_SESSION['state'] = md5(uniqid(rand(), TRUE)); //CSRF protection $dialog_url = "https://www.facebook.com/dialog/oauth?client_id=" . $app_id . "&redirect_uri=" . urlencode($my_url) . "&state=" . $_SESSION[

Authenticating the request header with Express

二次信任 提交于 2019-12-21 03:29:26
问题 I want to verify that all our get requests have a specific token in their authentication header. I can add this to our get endpoints: app.get('/events/country', function(req, res) { if (!req.headers.authorization) { return res.json({ error: 'No credentials sent!' }); } Is there any better way to handle this in NodeJS/Express without changing every endpoint? something like a before-filter/AOP approach? 回答1: That's what middleware is for: app.use(function(req, res, next) { if (!req.headers

Rails authentication strategy for noob

a 夏天 提交于 2019-12-21 01:57:19
问题 Hope this is not too broad but after a lot of googling I am not sure where to start. I am looking for a introductory/noob overview to help me get started on building an authentication implementation for a rails 3 application. Basic technical requirements: Rails 3 application is hosted on third party service (heroku) Need to use specific external private SSO service to authenticate users. No local user database or model in the rails application. Authentication is token based meaning that there

Unable to receive a permanent access token for my Shopify App

北城以北 提交于 2019-12-20 10:59:02
问题 I'm following the Shopify instructions to get a permanent token for a particular app/shop combination (http://api.shopify.com/authentication.html). I'm able to get the temporary token and then use a simple html form to receive a permanent token: But the response I get is: {"error":"invalid_request"} Can you help me, please? I searched everywhere (Stackoverflow, Shopify support forums, etc...) but cannot find a clue on how to solve this. My app is online and hosted on Heroku. Thanks, 回答1: I

How do I access my Firebase Database via HTTP REST API?

本小妞迷上赌 提交于 2019-12-20 08:30:03
问题 Thanks to this answer I am able to connect to Firebase 3 via HTTP REST API and an email/password. Logging in with this API returns an access token that is used to access the Firebase Database. This access token expires after 1 hour. A refresh token is also returned after logging in, which I can use to refresh my access token. Here is what I am doing specifically: Method: POST URL: https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyPassword?key=<my-firebase-api-key> Payload: {