How to login to McMaster-Carr API - json

I am a beginner trying to log in to McMaster-Carr API. I have a .pfx authentication file, an API password, and my main login/password (email/account password). I have imported the .json file into postman and have inputted my main login credentials in the fields below, but I am not getting a success output message. I am confused as to where the API key/password goes and where I upload the .pfx file as well.
McMaster-Carr API: https://www.mcmaster.com/help/api/

How to upload .pfx file to Postman application
[ Windows / Linux ] - Select File > Settings > Certificates
[ Mac ] - Select Postman > Preferences > Certificates
On the Client Certificates section, select the Add Certificate link
Add the hostname domain of the API service: api.mcmaster.com
Upload the .pfx file
Add the passphrase for the .pfx file: API password
Select Add (details should appear as below)
Close the screen and try to log in again with the same request

Related

Google Drive Api: receive push notifications on local environment

I'm interested in receive changes notifications form google drive api.
In order to receive notifications you have to make an http request with the addess where notifications have to be received:
Example:
POST https://www.googleapis.com/drive/v3/changes/watch
Authorization: Bearer auth_token_for_current_user
Content-Type: application/json
{
"id": "4ba78bf0-6a47-11e2-bcfd-0800200c9a77", // Your channel ID.
"type": "web_hook",
"address": "https://somedomain.com/notifications", // Your receiving URL.
...
"token": "target=myApp-myChangesChannelDest", // (Optional) Your channel token.
"expiration": 1426325213000 // (Optional) Your requested channel expiration time.
}
As you can see, I'm setting that google sends push notifications at "https://somedomain.com/notifications".
Nevertheless, I'm on a local/development behavior environment and I would need to receive notifications on my local ip.
Is there any alternative.
You could use something like ngrok, or localtunnel. To install them just follow their links.
They allow you to expose your localhost to the world for testing.
Ngrok example: ngrok http <local-server-port>
Localtunnel example: lt --port <local-server-port>
You could use localtunnel and set up a subdomain that is stable to your development and use it to verify the domain in google verification.
There is a command that sets your subdomain statically
lt --port 8000 --subdomain {subdomain name here}
and then I verified the domain in Google through downloading a verification file (More on this during verification).
You should not get a domain and use it during development just to verify with google or any other service. It will only increase complexity

gdrive command line oauth2: cannot fetch token: 400 Bad Request

Suddenly, gdrive command line tool stops working, and always gives the following error message:
Failed to get about: Get https://www.googleapis.com/drive/v3/about?alt=json&fields=maxImportSizes%2CmaxUploadSize%2CstorageQuota%2Cuser: oauth2: cannot fetch token: 400 Bad Request
Response: {
"error": "invalid_grant",
"error_description": "Bad Request"
}
This is because your authorization token has expired.
Currently there is an open Issue to improve this error message here.
You should delete your token with rm ~/.gdrive/token_v*.json
then run the gdrive about command to reauthorize
The steps I fixed it:
rm ~/.gdrive/token_v2.json as other answer suggested.
But I get danger error if I open the link get from gdrive about to re-authorize:
So I create a drive project by go to https://developers.google.com/drive/api/v3/quickstart/js and click "Enable the Drive API":
Click the "API Console" link on that dialog:
To make default redirect url (i.e. urn:ietf:wg:oauth:2.0:oob) works, we need Installed type app and can't use "Web application type app"(which only allow http/https scheme). So click "Create credentials" and choose "Oauth client ID" item:
Ensure select "Other" type:
Copy "Client ID" and "Client secret" from created item. cd to ~/.go/src/github.com/prasmussen/gdrive/, then replace both at this two variables in handlers_drive.go file, save it, e.g.:
const ClientId = "xxx.apps.googleusercontent.com"
const ClientSecret = "xxx"
Then run go install at that directory. Now run gdrive about and open that link in web browser. I get This app isn't verified error page. You are the author who created that app on above steps and suppose safe. Nevertheless simply click "Advanced" link and click Go to Quickstart (unsafe) link:
Click "Allow" it, copy/paste the code back to gdrive about and done:
Managed to resolve this by retriggering gcloud authorization with:
gcloud auth application-default login

Having issues with setting up yii2 basic framework and ibm bluemix

Having issues with setting up yii2 basic framework and ibm bluemix.
I was using this link as a guide: https://github.com/Twanawebtech/yii2App-Bluemix/blob/master/README.md
Step 1a: clone the code and setup
Open your terminal
$ git clone https://github.com/Twanawebtech/yii2App-Bluemix.git
$ cd yii2App-Bluemix
Step 1b: Set cookie validation key in config/web.php file to some random secret string:
'request' => [
// !!! insert a secret key in the following (if it is empty)
- this is required by cookie validation
'cookieValidationKey' => '<secret random string goes here>',
],
Step 1c: You can then access the application through the following URL:
http://localhost/yii2App-Bluemix/web
you should see the Congratulations Screen
Step 1d: Manifest
Go back to the yii2App-Bluemix folder
and open the manifest file
rename name and host to the name you want to call it.
Go to the command prompt and using cloud Foundary CLI (once you have setup cloud Foundary CLI)
enter cf login
API endpoint: https://api.ng.bluemix.net
enter Email Address:
enter Password:
Select a space (if you have more than one space allocated)
Step 2: Push your code to Bluemix
$ cf push yii2App-Bluemix -b https://github.com/cloudfoundry/php-buildpack.git -s cflinuxfs2
Step 3: Access your app by entering the following URL into your browser:
http://yii2basic.mybluemix.net/yii
However I don't get the congratulations screen but instead I get the following which is the source code of the index.php file found in the web folder
What am I missing or forgot to do???

Google_auth JSON key with Heroku config var?

To make a server-server interact with a Google API in development I need to put my service-account JSON key in the root of myapp, set
ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "api-test-key.json"
and all is good.
But in production on Heroku there are config vars and the google_auth credentials_loader.rb insists on a file.
I managed to put the JSON's contents in a heroku config var nicely and can get it by calling
puts ENV["GOOGLE_APPLICATION_CREDENTIALS"]
What to do?
There is this question where they figured out a workaround but that is for oauth2 not for service-account type JSON:
How to upload a json file with secret keys to Heroku
We config our GoogleAPI credentials via the application.yml file ... found in the root/config/application.yml file.
In it we have;
AUTH_URI: https://accounts.google.com/o/oauth2/auth
CLIENT_SECRET: xxxxxxx
TOKEN_URI: https://accounts.google.com/o/oauth2/token
CLIENT_EMAIL: xxxx
REDIRECT_URIS: http://localhost:3000/signin/connect
CLIENT_X509_CERT_URL: https://www.googleapis.com/robot/v1/metadata/x509/901506026811-q0am03i585627ptu5r38o7cpkt8pk98l#developer.gserviceaccount.com
CLIENT_ID: xxx
AUTH_PROVIDER_X509_CERT_URL: https://www.googleapis.com/oauth2/v1/certs
JAVASCRIPT_ORIGINS: http://localhost:3000
PLUS_LOGIN_SCOPE: https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/drive https://www.googleapis.com/auth/plus.circles.read
You could maybe load in your config settings here?

Where is Couchbase Sync Gateway AdminUI?

I have already set "adminUI": "0.0.0.0:4985/_admin/" in my config. I still get 404 page not found when going to the endpoint (e.g. http://<host IP>:4985/_admin/).
This is the description of the config line adminUI from http://developer.couchbase.com/documentation/mobile/1.2/develop/guides/sync-gateway/configuring-sync-gateway/config-properties/index.html
URL of the Sync Gateway Admin Console HTML page. The default is the bundled Sync Gateway Admin Console at localhost:4985/_admin/.
I got this hint from https://github.com/couchbase/sync_gateway/blob/aba088a902b162bcaed745510f4d012b8908a303/rest/config.go#L64
AdminUI *string `json:",omitempty"` // Path to Admin HTML page, if omitted uses bundled HTML
I omitted the line "adminUI": "0.0.0.0:4985/_admin/" from the config file to get the bundled Couchbase Sync Gateway Admin UI HTML page.