FeatureLayer access via arcgis online in html - javascript

See below for part of html code my featureLayer is saved in my arcgisonline;
var search = new Search({
sources: [{
featureLayer: new FeatureLayer("https://services1.arcgis.com/BZNs0xaSHDSi4V6G/arcgis/rest/services/postcodes/FeatureServer/0",
When I run the code, it ask to enter arcgisonline username and password.
when I do this, it says incorrect username and password.
This is the same username and password, I would have used to login in directly in my ArcGIS account.
Any hint or suggestion is appreciated!

Well, You might be typing incorrectly.
Because this is the only way to access secured(Non shared) layer. you HAVE to enter the AGOL credentials while accessing the secured(non shared) layer in your application.
There is alternative way to avoid the identity manager or Credentials simply share you AGOL GIS feature layer with everyone.
As you can see in below screenshot. (these are the layers published by you)
I am not able to see "postcodes" layers in it.
This can also be a reason that either you haven't publish the layer properly or it's not shared with anyone.
Hoping this will help you :)

Related

Google places AutoComplete widget is generating a new Session Key per every request

Recently, Google has updated some billing policies as part of that they've introduced SessionTokens for the Autocomplete requests.
As part of that, every request in the same session will be sent the same token in the request and it's automatic if we use the AutoComplete widgets provided by Google APIs.
But, I'm seeing a different token generated for every request in the same session. I'm I missing anything, please guide me. Here is the pluker for the sample, there I observed a different token generated for each keystroke.
var options = {
types: ['(cities)']
};
var searchBox = new google.maps.places.Autocomplete(input, options);
My Code for the page
<div class="searchField">
<input id="searchLocation" name="searchLocation" type="text" placeholder="Enter an Address">
</div>
<!-- more code.... -->
<!-- footer -->
<script>
// initiate search area for autocomplete of places from Google Maps Street Addresses
function initAutocomplete() {
// define the search location box
var searchBox = $("#searchLocation")[0];
// initiate the autocomplete with the options on the search box
var autocomplete = new google.maps.places.Autocomplete(searchBox, options);
};
</script>
<script src="https://maps.googleapis.com/maps/api/js?libraries=places&region=ca&language=en&key= [YOUR_API_KEY]&callback=initAutocomplete" async defer>
</script>
Session Token Clarification
According to the Google Docs (all the way at the bottom of the page in a "warning text")...
https://developers.google.com/maps/documentation/javascript/places-autocomplete
Warning: Be sure to pass a unique session token for each new session.
Using the same token for more than one session will result in each
request being billed individually. Note that the Autocomplete Widget
handles sessions automatically (you don't need to do anything
additional). Now, lets dive into the basic Javascript example.
This may be a bit confusing, only because you are trying to get into the nomenclature of the google docs and what these things and possibly because you were doing it one way and suddenly your boss or client or someone else ask you to use Sessions/Session Tokens instead.
If you do new google.maps.places.Autocomplete() instead of AutocompleteServices or something along those lines, you are using the "Autocomplete Widget".
The autocomplete widget will handle the session / session tokens itself.
Prove it!
I trust Google and the Google Developer Documentation regarding their own products and how/what they do, but there was plenty of confusion on the web about this. So I wanted proof, besides getting a bill after a month. FYI - the billing in Google Clound Platform Console (https://console.cloud.google.com/google/maps-apis?pli=1) will show you this almost right away and will corroborate the stuff below and above.
Looking at the Network activity in Dev Tools, we see that there is a few calls to the Autocomplete Service.
I did not use the "AutocompleteService" function here, this is a basic example setup the same way I have listed above for the Callback with using the "Autocomplete Widget" via new google.maps.places.Autocomplete().
When you go to the page, you can see the call to library first, first screenshot of Dev Tools below.
Next I did a search, which worked. I started to type in a basic address of 1990, you can see 4 request made to the API after that. 1 request/call for each character I type in. Each of these request names begin with "AutocompleteServices.GetPredictions...", even though I DID NOT USE AutocompleteServices in my code. On the back-end, the "Autocomplete Widget" is using the "AutocompeleteServices" and doing all the UI/UX work for you as well as the functionality and the session and tokens. These are in the Dev tools screenshots #1-#3 below.
Then you see a 5th request call to "PlaceServces.GetPlaceDetails", which was when I selected from the dropdown. This is the dev tools screenshot #4 below.
Looking at the headers, for each of these requests, I see a few things.
The first thing, circled at the bottom is a "token". I know I just said and the Google Documentation just said that the "Autocomplete Widget" handles the session token, and a keen eye will see that this "token" value is different for every request. It is also not in 'version 4 UUID' format, which is recommended by Google, but that is a different topic. This "token" in the header, IS NOT the session token. This is buried in documentation that is 5 years old for a previous version of this on Google Docs, but this is not used anymore, and is auto-set for each request and is not the Session token.
SO, "where is the session token then?" you might ask.
The other items in the header that start with 1s, 2s and so on are different session variables that are passed. In this case, the session token is '20s' followed by the version 4 UUID auto created by the "Autocomplete Widget". A keen eye will also notice that for the 3 screenshots below they are the same. I have a fifth screenshot after the page refreshes that shows that the Session Token has changed. You can see in my code that I did not specify those things, but because I am using the "Autocomplete Widget" they are done for me.
I'm afraid token parameter that you can see in the request is not the places autocomplete session token. This parameter was there even before Google Maps platform changes. I don't know how Google manages handle autocomplete session tokens, probably they handle them server side.
The documentation states that autocomplete widget has automatic session tokens implemented.
Autocomplete (Web Service and JavaScript) and the JavaScript Autocomplete widget have been updated to use session-based billing.
Note: No code changes are required for the JavaScript Autocomplete widget, as the widget manages sessions for you automatically.
source: https://cloud.google.com/maps-platform/user-guide/pricing-changes/
To be sure I would suggest checking you billing reports in developer console.
https://console.cloud.google.com/billing/unbilledinvoice?project=YOUR_PROJECT_ID&authuser=1
In this report you will see which method was used for billing of places autocomplete requests. Have a look at rows where Product column is Places API and the Resource column will show which method was used for billing Autocomplete - Per Request or Autocomplete - Per Session.
If you use Place autocomplete widget with automatic sessions, but this report shows only usage of Autocomplete - Per Request reach out to Google maps technical support via https://console.cloud.google.com/google/maps-apis/support
If you use google.maps.places.Autocomplete(input, options); it will add session token automatically.
In your pluker example there is no Autocomplete but new google.maps.places.SearchBox

Does anyone have the ability to create an account with my key?

EDIT : tried the authorized domain and it seems to be what i need, i'll try to go deeper with André's answer :)
Thank you !
Hi,
I'm new to firebase and i just finished a project but i had a question:
Since the doc says i have to put my api keys and else in the javascript, they are visible to anyone even if put into process.env
i've read here : Is it safe to expose Firebase apiKey to the public?
that making the api key public is normal and not a big deal.
I'm using the email/password auth and i'm scared
If someone takes my :
API_KEY_FIREBASE
AUTH_DOMAIN
DB_URL
PROJECT_ID
that are in the source code and use the createAccount function, is he gonna be able to create an account ?
Is yes, is there a way to disable this ?
I want to be able to create account only through the firebase console
I'm not using firebase database for my data, i only use it for auth so i don't have to create a user table in my database, but i use the IDTokens they provide to secure some routes on express.
thank you ! :)
Someone can only create an account when you have that option enabled in your firebase console. So If you have it disabled there is no problem.
You can look here in the "before you begin" section for how to enable/disable Email/password sign-in method.

Arcgis javascript TOC with secure services

I have secured map services with AGS. I also have the proxy.config, proxy.ashx, and web.config in my application. My map layers display OK using the proxy. When I try to display my legend using the proxy map layers, a login dialog shows up and the legend does not display. If I enter my username and password the legend displays. When I use unsecured services from an AGS server the legend displays fine.
Has anyone experienced this?
Looks like the problem is with you proxy, check if it is getting the legend request. If not, you could configure the proxy url in esriConfig properties to always use proxy.
esriConfig.defaults.io.proxyUrl = "<url_to_proxy>"
esriConfig.defaults.io.alwaysUseProxy = true;
Hope this helps

Can't link Twitter with Satellizer.js

The Facebook, Google and Yahoo login for satellizer.js was pretty straight forward. All I had to do was create apps with their respective API's, configure them with my homepage's URL. Then I added the app-ids to the app.js file:
$authProvider.facebook({
clientId: 'xxxxxxxxxxxxxxxxx'
});
and lastly I added the app id and secret in the config.js file server-side.
I thought this would be the process with Twitter too, but their API keeps giving me an error saying
Something is technically wrong. Thanks for noticing—we're going to fix
it up and have things back to normal soon.
and no additional information is given, which leaves me with finding the needle in the haystack.
Are there any additional measures that I need to take to make the Twitter authentication work?
Be sure to set the right twitter secret and key.
I had the same problem until I rrealised that there was a space as the first character in the string of my twitter key.
This causes the same behavior you described

Google Sites. JS connection with spreadsheet

Using Google Sites, How can I connect to another user spreadsheet using username and password, alike one usually does with mysql?
I tried the following, but it did not work :
var opts = {dataType:'json',username:'xxxxx',password:'xxxxxx'};
var query = new google.visualization.Query(urlTable, opts);
yes i need to connect to a spreadsheet, who owner is other user(spreadsheet is in other account), from code JS with top two lines that i posted at the first post in this thread
using username and password that i have
i see this https://developers.google.com/gadgets/docs/oauth#examples but i dont understand well
thanks
The error in site is Access denied because the owner of document is other gmail account...

Categories