Lyft API get access token - lyft-api

I need to get an access token in order to ping Lyft API requests and, as per Lyft API documentation, I need a client_id and a client_secret as username and password.
I've used my phone number and validation code as the "username" and "password" for the Lyft account I already have.
I've also tried other options such as my email address but not sure what password should be. Because Lyft accounts do not use passwords, right?
I'm getting below response when I do the curl to get the access token
Much appreciate some help! Thank you.
{
"error": "invalid_client",
"error_description": "Unauthorized"
}

The client_id and client_secret are not your own username and password. You will need to go to the Lyft developer portal, create an app, then a client id and client secret will be generated that you can use to obtain an acceess token.

Related

Creating the users in the google domain (python)

I am creating an application in which I am getting a Client_secret.json file, and in my application I'm trying to load that json file and get the credentials from it using the following code:
credentials=get_credentials(filename)
http = credentials.authorize(httplib2.Http())
service = discovery.build('admin', 'directory_v1', http=http)
userinfo = {'primaryEmail': primaryEmail,
'name': { 'givenName':user },
'password': password
}
service.users().insert(body = userinfo).execute()
It gives the following error:
httpError 403 when requesting https
//www.googleapis.com/admin/directory/v1/users?alt=json returned
insufficient permission
I'm not sure what I'm doing wrong or am I missing something? I was wondering if the problem is in the json file which I'm creating?
Any help would be appreciated.
Thanks,
Aman
Well, you can start by checking a few things:
If you're using a service account, be sure to enable the "wide domain delegation option" to allow a service account to access user data on behalf of your users and perform operations.
Check if the scope https //www.googleapis.com/admin/directory/v1/users is authorized for your client ID on your google admin console > Security > Advanced settings > Authentication > Manage API client access.
Check if the user that you're using to insert the new user have enough privileges a.k.a super admin privileges.
Check if the Admin SDK API is active on your project.
Keep in mind that just downloading the client_json and activating a API isn't enough to allow these types of operations. For certain APIs like Admin SDK, the user you're gonna use to consume those services need to have specific privileges.
Here's a few helpful links
https://developers.google.com/identity/protocols/OAuth2ServiceAccount#delegatingauthority
https://support.google.com/a/answer/162106?hl=en
I would first check to make sure that you have the correct Admin privileges on the account that you are trying to use OAuth credentials on. I would try logging into the account and going to this reference page in the Directory API for Users:insert
https://developers.google.com/admin-sdk/directory/v1/reference/users/insert
On the right hand side you should go to the Try this API section and see if that account has permissions to create new users.
Also another thing I noticed as well, is that you're not setting the required field familyName inside of the name field. familyName is a required property.

How to get the email address for the current logged in user in EWS?

What is the correct way of getting a user's email address using EWS SOAP API's if I have the credentials (username & password) and the server address.
What you need is as follow:
Create a AuthenticationContext
Setup a ClientCredential
Use AuthenticationContext to acquire a token
You will have to pass a callback which if the authentication is fine, you will receive AuthenticationResult in onSuccess of AuthenticationCallback
You can get the information from AuthenticationResult.UserInfo.DisplayableId

Login user to my website in Chrome app

I have users registered to my website that connected their Google+ account, and I'd like to auto login them from a packaged Chrome app.
I'm following [1] and the related example [2].
I can successfully perform a Google account authentication and obtain a token and user info.
Next, I'd like to "exchange" Google token for a "my website" token.
I was thinking to:
app sends to server the token and user_id
server requests https://www.googleapis.com/plus/v1/people/me and verifies that user_id and token match
server searches for the user corresponding to (google) user_id and logs he in
The alternative would be to implement an oauth login form and follow Non-Google account authentication in [1], but it seems too much extra work to me.
Any suggestion / alternative way?
[1] http://developer.chrome.com/apps/app_identity.html
[2] https://github.com/GoogleChrome/chrome-app-samples/tree/master/identity
[edit: as pointed out in comments, not a secure method.]
Use the identity api to make a request from the app to get the google+ id:
GET https://www.googleapis.com/plus/v1/people/me?key={YOUR_API_KEY}
(with the https://www.googleapis.com/auth/plus.me oath scope)
In the response you will find
{
"kind": "plus#person",
...
"id": "117022097663427079142",
Send that ID to your server to look up the associated ID that your system uses.
You do not need to (and should not) send the bearer token.

box.com authorization with over sockes

please help me authorize with direct sockets on box.com
my software uses socket communication
to get authorization code I'm sending client_id
http.HTTPMethodWithRedirect('POST',
'https://www.box.com/api/oauth2/authorize?response_type=code&client_id=omrtodqahh6cj9i2w9hytnvmlqdiivvt','','')
but getting back a webpage, not JSON code that i expect.
Box will always return a webpage after the first leg of the oauth process. Your application won't receive an authorization_code until after a user has logged into their account with valid Box credentials and accepted the oath2 grant for your app. More info here http://developers.box.com/oauth/

Twitter API GET statuses/user_timeline - how to include authentication?

For the example get request:
https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=twitterapi&count=2
As documented here:
https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-user_timeline.html
I have an oauth user token and user token secret, plus my app credentials...
The docs state that authentication is supported, but how do I include it in the get request for screen names that are not publicly accessible?
If I understand your question right, you want to be able to get the tweets from a third-party user with the OAuth token and secrets belonging to a user on your site. The tweets from the third-party user are not publicly accessible, but your user has access rights to them. Is this right?
Generally if you want to access private ressources on behalf of your user, you have to sign the request with the OAuth token and your application credentials. Then Twitter can check, which user is signed in on your site and if the user gave your site access rights.
That signature is sent within the header of your GET request in a format like this:
Authorization:
OAuth oauth_consumer_key="xvz1evFS4wEEPTGEFPHBog",
oauth_nonce="kYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg",
oauth_signature="tnnArxj06cWHq44gCs1OSKk%2FjLY%3D",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="1318622958",
oauth_token="370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb",
oauth_version="1.0"
There is also documentation from Twitter on how to calculate the signature.