Get Portal url (Host url) in ArcGIS Online Rest API - rest

I am new to Rest API and trying to develop a client for ArcGIS Online. I tried to login to ArcGIS.com using my login credentials and then see the maps that I have posted on the server. When I click on any map, it opens up in browser with a url like this.
https://services.arcgis.com/N2SwjtBNabcd069C/arcgis/rest/services/IMap/FeatureServer/1
Then I created a different login account, and then published map and tried to open that in browser it showed up with a different url like this
https://services2.arcgis.com/N2SwjtBNabcd069C/arcgis/rest/services/IMap/FeatureServer/1
Note the start of the url
first one is
https://services.arcgis.com/
and second is
https://services2.arcgis.com/
Now my problem is when I try to login in my client application that I am developing. I am able to generate the token, account id and account name. But how do I know which server should I search for to locate my layers(i.e. services2.arcgis.com or services.arcgis.com)? Where can I get this information from
P.S: N2SwjtBNabcd069C in above url is the account id

After you login, and generates your token you can make the following query to see the url of your content.
http://www.arcgis.com/sharing/content/users/<username>?f=json&token=<generatedToken >
This will return you the json that contains the url of your service.

Related

How to achieve silent login and get code/token from google using OAuth 2

I am new to google oath ,
Referring to the documentation of google
While i Generate the login URL
example
https://accounts.google.com/o/oauth2/auth?
redirect_uri=http://www.mywebapp.com/oauth2callback&
response_type=code&
client_id=104608secret-secret-secret-secret.apps.googleusercontent.com&
scope=https://www.googleapis.com/auth/analytics.readonly+https://www.googleapis.com/auth/userinfo.email&
approval_prompt=force&
access_type=offline
This redirects to an accept page showing google email Id
When the user clicks on “Accept” google will redirect the user to your given redirect_url
when i use chrome and
https://developers.google.com/oauthplayground/
Because it redirects screen to accept.
everything will work fine.
But when i use postman it wont return the "access code" of google
What am i making wrong in the url parameters .
I have to create rest service using the above url.
I have searched So for
How to get dummy google access token to test oauth google api?
How can I verify a Google authentication API access token?
https://developers.google.com/identity/protocols/OAuth2
https://www.themarketingtechnologist.co/google-oauth-2-enable-your-application-to-access-data-from-a-google-user/
But non explained about silent login to get token without accept screen
Your callback url receives a "code".
Then you need to exchange your "code" for an access token.
https://aaronparecki.com/oauth-2-simplified/
https://developers.google.com/oauthplayground/
https://developers.google.com/identity/protocols/oauth2

Outlook Graph API call from Sap ui5 Application web ide to Connect the outllok calender to Sap ui5 application

I am trying to call graph api so I had followed the procedure mentioned on the site. I had registerd the App in https://apps.dev.microsoft.com/portal/register-app
and got the client id and and then I am trying to make a ajaxs call url
"https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=XXXXbxxxxxxx-bf22-4bdb-bXX-cd32a729a31f&redirect_uri=https://webidetestingXXXXXX-XXXXXXXXXXX.dispatcher.int.sap.hana.ondemand.com/webapp/index.html&response_type=code&scope=openid+Mail.Read";
this always opens a login page and How can I pass the username and password after the call.
second-I call this url and enter the credentials it shows me an error of Microsoft account is experiencing technical problems. Please try again later.
Can you please guide me what i am missing or any example in sap ui5 environment to call such graph Api
this always opens a login page and How can I pass the username and password after the call.
When directing the user to the /authorize endpoint , microsoft server will show the login page to let user enter the username/password , after that you couldn't pass username/password to that in your own code .If you don't want to show the login page or need to use own login page , it is possible to sign in a user with the username and password flow as noted here. But that flow needs writing passwords for identity provider into your custom website , and you should check more at the Constraints & Limitations section .
I call this url and enter the credentials it shows me an error of Microsoft account is experiencing technical problems.
Please provide more details of that error , you could find error message in browser address bar like :https://login.live.com/err.srf?lc=1033#error=invalid_request&error_description=xxxxxxxxxx

Azure Mobile Service OAuth REST Client

I managed to develop a Azure Mobile Service and an iOS application which connects to my service using Facebook authentication. Everything works perfectly fine from the app.
Now I'm trying to access my mobile service from a regular HTTP REST client and I'm hitting authentication issues. I tried to get the authentication code from FB and set the code in X-ZUMO-AUTH header but this does not help. I still get the "Authorization has been denied for this request" error.
I would really appreciate if someone could point to the right direction on how to mimic the access to the mobile service just like the iOS app is doing it.
Thanks,
Ruben
The token you must supply as the 'X-ZUMO-AUTH' is not the access token that facebook send back to you; it is the token that your mobile service backend send back to you.
In order to get a valid token, access the following url in your browser 'https://mymobileserviceurl/login/facebook'. Then fill your facebook infos and you should be redirected to a page which url looks like 'https://mymobileserviceurl/login/done......'. This url contains a 'authenticationToken' parameter. This is the value you have to paste in your 'X-ZUMO-AUTH' header. (should begin with 'ey' and avoid copying ASCII chars)
In your application, in order to get the right token, you should call MobileServiceClient.LoginAsync.

How to get facebook code from redirect uri in Java desktop application

im a newbie in graph facebook api. I try to get MY_VERIFICATION_CODE by send http request:
link1: https://facebook.com/dialog/oauth?client_id=APP_ID&redirect_uri=https://www.facebook.com/connect/login_success.html
and then Facebook will redirect to http://www.facebook.com/connect/login_success.html? code=MY_VERIFICATION_CODE
but I cant get code from response. I copy link1 to chrome, it redirects to url with a code appended as parameter, but this url stays just for seconds and then it changes to this: https://www.facebook.com/connect/blank.html#=
My question is how to read the code from the redirected uri in a java desktop application?
It's all described in the docs at
https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/v2.3#login
Quote:
When using a desktop app and logging in, Facebook redirects people to the redirect_uri mentioned above and places an access token along with some other metadata (such as token expiry time) in the URI fragment:
https://www.facebook.com/connect/login_success.html#access_token=ACCESS_TOKEN...
Your app needs to detect this redirect and then read the access token out of the URI using the mechanisms provided by the OS and development framework you are using. You can then skip straight to the Inspecting access tokens step.

Create website with facebook login for 0fees.net

Today I was trying to add Facebook features to my site. It's hosted on 0fees.net.
On 0fees.net, I uploaded index.html to my web host, for example mysite.0fees.net. This works, and the page opens fine when I access the URL.
Then, on Facebook, I created my Facebook application, and set the 'Website with Facebook Login' setting as http://mysite.0fees.net/, pressed Save Changes. But I got the error message,
Error Site URL is not a valid URL.
When I try set another URL (for example mysite.1fees.net) the application saved fine.
I do not want to change provider, so how can I set mysite.0fees.net?
When trying to post the link http://0fees.net/ on Facebook, you’ll see a message that you can not do so because the domain is blocked for being spammy. So you’ll have to use another domain, I’m afraid. (That’s the problem with cheap webhosting where you’ll only get a subdomain – let one user do something stupid under that main domain, and all other’s using it will get punished as well.)