I followed Ray Wenderlich's excellent, and brand new, tutorial on setting up Parse Server and Parse Dashboard on Heroku.
Migrating to Parse Server for Heroku
When setting up Parse Dashboard, it says to edit the parse-dashboard-config.json file as follows:
{
"apps": [
{
"serverURL": "WHAT_GOES_HERE",
"appId": "shhh",
"masterKey": "shhh",
"javascriptKey": "shhh",
"restKey": "shhh",
"appName": "AppName-Heroku"
},
{
"serverURL": "http://localhost:1337/parse",
"appId": "shhh",
"masterKey": "shhh",
"appName": "AppName-Local"
}
]
}
The question is, why have two apps listed here? When I run the dashboard, my "localhost" app actually points to, and updates, the mlab db on heroku.
The "heroku" app is empty, likely because I don't have the correct serverURL. What is the correct URL for this?
Your two questions:
Why are there 2 apps listed in the config file?
This is because the tutorial demonstrates on how to migrate an existing app from Parse.com to your own Parse Server. The first app configuration points to the app on Parse.com as you can see by the API endpoint https://api.parse.com/1 in the tutorial which you replaced by "what_goes_here". The second app configuration point to your self-hosted Parse Server instance that you have running on your system as you can see by the API endpoint http://localhost:1337/parse.
What is the correct URL for the property serverURL?
The API endpoint https://api.parse.com/1 is the correct URL for your Parse.com hosted app, you must not change this URL, it is the same for every Parse.com customer. The API endpoint for your self-hosted Parse Server can vary depending on your system configuration but usually it is http://localhost:1337/parse.
Related
Following the steps for creating incoming webhooks via add to slack button. The final response will look like this:
{
"access_token": "xoxp-XXXXXXXX-XXXXXXXX-XXXXX",
"scope": "incoming-webhook,commands,bot",
"team_name": "Team Installing Your Hook",
"team_id": "XXXXXXXXXX",
"incoming_webhook": {
"url": "https://hooks.slack.com/TXXXXX/BXXXXX/XXXXXXXXXX",
"channel": "#channel-it-will-post-to",
"configuration_url": "https://teamname.slack.com/services/BXXXXX"
},
....
}
This provides access to team_name, channel the webhook will post to, and a url for configuration.
While this is working great and after initially storing the 'configuration' to my own webapp it displays correctly. But after a someone uses the 'configuration_url' link from the response these previous values like the channel could become obsolete. For example the webhook could be deleted from this link.
My Question is:
Is there a way to reflect this changes in my external app? As far as I can see there is no way to query information for 'incoming webhooks' via an api call from an external web application?
I also could not find any api calls that could change webhook configuration directly without using the provided link.
Its not possible to change the webhook configuration after it is created. The only possible change is that the workspace that installed your Slack app (which contains the webhook) is uninstalled.
If that happens the webhook will no longer work and you will get an error in response.
You can also get notified when you app is uninstalled by listening to the app_uninstalled event.
Or you can also test if your app and webhook is still valid by checking the token you received during the Add to Slack process. Just call the API method auth.test with that token. If it returns the following error than the webhook is no longer valid:
{
"ok": false,
"error": "invalid_auth"
}
I'm a bit of a AWS newbie so forgive me if this is a stupid question. We have a legacy Classic ASP website (not hosted at Amazon) and I wanted to know if its possible to utilize Amazon Cloudwatch for custom logging. I know we could use a site like Loggly or Sumo Logic but their retention policies are a little short and the pricing a bit too expensive for our small site. But essentially, I'm trying to recreate their functionality in AWS.
There is quite a bit of detail on how to log from various Amazon services (EC2, etc...) but I'm not finding much on using Cloudwatch from a non-Amazon hosted site
Basically, I want to SERVERXMLHTTP POST a json log string from our Classic ASP site to Cloudwatch. However, I'm struggling to find the right endpoint and how to post to a particular Log Group that I've created. Do I use
https://monitoring.us-west-1.amazonaws.com/doc/2010-08-01/?Action=PutMetricData
or
https://logs.us-west-1.amazonaws.com/doc/2010-08-01/?Action=PutMetricData
to try to post json like this
[
{
"MetricName": "404 Error",
"Timestamp": "Wednesday, June 12, 2013 8:28:20 PM",
"Value": "http://example.com/badpage.asp",
"Unit": "Count"
}
]
Also, how do I post the json to a particular log group / log stream that I've created? Do I authenticate with some sort of
xxx.setRequestHeader "Authorization", "Basic " & [auth credentials]
?
Thanks for any help!
You can find the list of AWS endpoints here: http://docs.aws.amazon.com/general/latest/gr/rande.html
logs.us-west-1.amazonaws.com
The authentication is done with signed requests: http://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/making-api-requests.html
When you send HTTP requests to AWS, you sign the requests so that AWS can identify who sent them. You sign requests with your AWS access key, which consists of an access key ID and secret access key.
And about the specific API call to put the log probably is PutLogEvents: http://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html
Uploads a batch of log events to the specified log stream.
And remember there's a SDK for the browser: https://aws.amazon.com/es/sdk-for-browser/
I set up Google SDK to use Google API with Application Default Credentials. For my local machine, created a credentials json file and set its path as GOOGLE_APPLICATION_CREDENTIALS as environment variable. This is worked as expected without a problem.
However, when the app is deployed to Google Cloud VM, it throws the following error:
[Google_Service_Exception]
{
"error": {
"code": 403,
"message": "Request had insufficient authentication scopes.",
"errors": [
{
"message": "Request had insufficient authentication scopes.",
"domain": "global",
"reason": "forbidden"
}
],
"status": "PERMISSION_DENIED"
}
}
According to the documentation, the built-in service account should be associated with the virtual machine instance. To make it work, I tried to use credentials json file as I did on local machine (which worked fine) but it didn't work either.
To note, the error message is about scopes but not auth problem. What to do to make it work on Compute Engine VM instance?
To give client initialisation code:
$client = new Google_Client();
$client->useApplicationDefaultCredentials();
$client->addScope(Google_Service_Pubsub::PUBSUB);
Update
Now it is supported. You have to stop instance in order to change API scope.
https://cloud.google.com/compute/docs/access/create-enable-service-accounts-for-instances#changeserviceaccountandscopes
Original answer
It turned out that I had to enable Cloud API access scope for the services on Google Cloud Console for VM instance details: https://console.cloud.google.com/compute/instances
Unfortunately, I couldn't changed it because Google Cloud doesn't support it for now. I had to start a new instance to enable a service API access.
https://googlecloudplatform.uservoice.com/forums/302595-compute-engine/suggestions/13101552-ability-to-change-cloud-api-access-scopes-on-launc
It is possible now. Your instance must be stopped and then it can have its scope list changed from the console in the edit vm page, or in the SDK by using :
gcloud compute instances stop [vmname]
gcloud beta compute instances set-scopes [vmname] --scopes="[scopes list]"
Just be aware that with the SDK way, the second command will reset with the scopes in the list. It is not currently available the ability to only append a new scope.
i wanted to test some API Requests from Proximity Beacon API. So i followed the steps from this site and put a test redirect url (https://developers.google.com/oauthplayground) into the OAuth-2.0-Client-ID. When i try to make an request from the playground i get following output:
{
"error": {
"status": "PERMISSION_DENIED",
"message": "Google Proximity Beacon API has not been used in project google.com:oauth-2-playground before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/proximitybeacon.googleapis.com/overview?project=google.com:oauth-2-playground then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
"code": 403,
"details": [
{
"#type": "type.googleapis.com/google.rpc.Help",
"links": [
{
"url": "https://console.developers.google.com/apis/api/proximitybeacon.googleapis.com/overview?project=google.com:oauth-2-playground",
"description": "Google developers console API activation"
}
]
}
]
}
}
obviously it is using the wrong project, but i only got to a step where i was able to pick my account but not my project. i checked everything twice and my only guess is that i cannot use this redirect_url.
So my question: Why is it trying to use the project google.com:oauth-2-playground instead of mine? And how can i change this?
The Proximity Beacon API was not enabled on the default credentials that the OAuth 2.0 Playground uses. I've just enabled that API and now this should work.
Alternatively you can setup the OAuth 2.0 Playground to use your own app's OAuth Credentials (Client ID and Client Secret) in the configuration menu of the playground.
I'm trying to initiate a Square Register payment from a web app. The web app will only run on iPads that are within my control.
The HTML I'm using to call it takes this form:
Open Square Register
Where the data parameter is, I believe, a properly URL-encoded form of this:
{
"amount_money": {
"amount": 500,
"currency_code": "USD"
},
"callback_url": "https://mycallbackurl.org",
"client_id": "{{my_app_id}",
"merchant_id": "{{my_merchant_id}}",
"supported_tender_types": [
"CREDIT_CARD",
"CASH"
]
}
The Square Register app is giving me this error:
API ErrorSorry, we could not process the incoming request. Please try again or contact support.
What am I doing wrong? Is this possible to do from a web app, as I'm trying to?
This error can occur if your application is not authorized to use the Square Commerce API. From the documentation:
The Commerce API is currently available only to approved partners. If you're interested in using the Commerce API to integrate your iOS app with Square Register, please contact partners#squareup.com.
In their API docs it says that supported tender types should be nested under options:
{
"options": {
"supported_tender_types": [
"CREDIT_CARD"
]
}
}