Comments (3)
(Note, I didn't test this too much, it's from memory).
Make sure your app is set up properly, and that you've enabled the Contacts API in the Google Developers Console at https://console.developers.google.com/project. Then try this:
CLIENT_ID = '?????.apps.googleusercontent.com'
CLIENT_SECRET = 'your_secret'
REDIRECT_URI = 'url_you_registered_with_google'
client = OAuth2::Client.new(CLIENT_ID, CLIENT_SECRET,
site: 'https://accounts.google.com',
token_url: '/o/oauth2/token',
authorize_url: '/o/oauth2/auth')
url = client.auth_code.authorize_url(scope: "https://www.google.com/m8/feeds",
redirect_uri: REDIRECT_URI)
Then visit url
in your browser and log in to Google. The url you are redirected to afterwards will contain the token in the parameter code
. It will look like this (not actual code to run, just an interpolation example):
redirect_url = "#{REDIRECT_URI}?code=#{code}"
Parse the code from the redirect url, then construct an API client as I describe in the docs.
token = client.auth_code.get_token(code, :redirect_uri => REDIRECT_URI)
google_contacts_user = GoogleContactsApi::User.new(token)
from google_contacts_api.
Since I haven't heard back from you I'm going to close this issue
from google_contacts_api.
Thanks Aliang for explaining and closing the issue. Sorry for late reply, I'm on a holiday.
from google_contacts_api.
Related Issues (13)
- implement inspect method for User
- implement ResultSet.next_page method
- Got an answer for this one? HOT 1
- Also include an OAuth2 example in README
- Deprecate OAuth 1.0
- Turn oauth2 access_token string into object? (OmniAuth & OAuth2) HOT 1
- Set up testing with live account HOT 1
- Support for Service Accounts? HOT 8
- Getting contacts from Access Token HOT 1
- Sort/Order functionality? HOT 2
- uninitialized constant Api::TransactionController::GoogleContactsApi HOT 3
- Add contact to google contacts
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from google_contacts_api.