No auth in c2dm response - android

When I'm trying to use POST to get the Auth token from the ac2dm service I only get the SID and LSID, not the Auth, has this happened to anyone else, if yes, how did you solve this?
I'm using .NET (C#) on the server side, I have tried to send the post call with fiddler to but I'm getting the same result.
Post call in fiddler:
Content-Type:
application/x-www-form-urlencoded
Host: www.google.com Content-Length:
125 Expect: 100-continue
accountType=HOSTED_OR_GOOGLE&Email=myRegistredMail&Passwd=myPassword&Service=ac2dm&source=myAppPackageName
and the response (i get response code 200 so it should work):
SID=DQAAAMgAAADhKR...
LSID=DQAAAMoAAACCR...
as you can see there is no Auth token in the response...

Its as simple as big and small letters...
It should be service with a small "s" and Source with a big "S".
Thanx to MightyPush at android-c2dm group for pointing this out:)

Also if you are seeing the spanish documentation, instead of service it is wrote that you must use servicio, but this does not work.So for this to work, the keywords are
accountType
Email
Passwd
service
source

Related

How to see the response in Postman with Header and Request parameter for API

our api contains header and Request parameter like below
This is the URL: http://itaag.us-east-1.elasticbeanstalk.com/register/
Method: POST
Http header:
deviceid - unique id of the device (no validation for now. takes any value)
userType - personal or business
key - phone number or email id (phone number is validated for any 10 digits)
Request :
Request parameter name: "registrationdetails"
Sample Request user:
{"firstName":"Sample",
"lastName":"Test",
"email":"sm#gmail.com",
"gender":"male",
"ageGroup":"40-50"}
Response Should be like this:
{"userId":"dfsfewrwebegergbfdbert"} {"businessId":"refsfsdkkdsfsnjkfsdfhidshfih"}
Possible errors:
General error
Invalid email
Invalid phone number
Invalid GST
Notes:
Use http response code 200 for success and http response code 400 for failure.
If i give request like below mentioned answer then i am getting like this:
How do i get response in postman, please help.
As per my understanding you can get response by doing this steps:
I hope it will help you.
Thank you.

how to get (access token) for youtube data api? Authorization: Bearer [YOUR_ACCESS_TOKEN]

POST https://www.googleapis.com/youtube/v3/commentThreads?part=snippet&key=[YOUR_API_KEY] HTTP/1.1
Authorization: Bearer [YOUR_ACCESS_TOKEN] issue is here how to resolve this, i am confused.
Accept: application/json
Content-Type: application/json
I finally found an explanatory answer to this problem that I was also facing, it may help you and others!!
Basically, you have two strings:
the ClientId (it's used on both: client and server)
the SecretKey (that must never come to the client-side!)
The user sees in the page a link: Click here to login (e.g.). When he clicks there he is redirected to the Google pages. He is asked to accept your application. If he clicks the Deny button you will get an error message: Access denied by the user (probably..). If he clicks Yes, you will get a temp code that is used to get the access token. You will make a POST request to https://accounts.google.com/o/oauth2/token providing the client_id, secret_key, code, redirect_uri, and grant_type parameters in the form data.
Then you will finally get the access token!
Complete discussion link:
https://github.com/IonicaBizau/youtube-api/issues/5

Authentication with oauth2 on soundcloud api

I'm trying to get logged in soundcloud by using their API. I manage to got a code with a success response from /connect but when I try to get a token, I end up with a 401 error. Here is what I send :
POST /oauth2/token HTTP/1.1
Host: api.soundcloud.com
Content-Type: application/x-form-urlencoded
Cache-Control: no-cache
Postman-Token: 255c7769-0f65-5c40-27bc-9429ea8c38ea
client_id=<my client id>&
client_secret=<my secret id>&
redirect_uri=http%3A%2F%2Fmywebsite&
grant_type=authorization_code&
code=a99cfc85c0e46235d7fdb9ca74b7dddd%23
Does anyone knows what I miss here to get a working request ?
It turned out I was not calling /connect correctly, this is the correct way :
https://soundcloud.com/connect?
client_id=<my client id>
&redirect_uri=<my redirect url>
&response_type=token
&scope=non-expiring
&display=popup
With response_type=token, we directly receive an access token so we don't need to call /oauth2/token then.

Authenticating a file stream from android to wcf

I have an app that makes request to a wcf service. Usually I authenticate all of the requests using a hash value that is sent in the body of the request and then authenticated on the server. All most all of the request are sent via json and it is easy for me to add the hash value to the body of the request. The issue I am facing is that when I send a file stream I cannot add the hash to the body of the request so I am wondering how I can authenticate that the request came from my app and not from some where else. All suggestions are greatly appreciated.
Adding an authorization item in the header is a possible solution. So, if anyone is interested, read this and this.

Yahoo messenger API - error when open a long-lived connection for Comet-style notification

I'm trying to get Yahoo messenger notifications (comet style) to work on my Android app but I got a problem:
I have all the oauth tokens + IM cookie, I make the call to notify server but it responds with
403 Bad IM cookie or URI credential
The IM cookie which is sent is correct because it is the same as the one I got from POST /session.
The call:
POST to:http://rproxy2.messenger.yahooapis.com/v1/pushchannel/user_id?sid=T3qRkifs3BiGXCW4LOSoThi3lG2HvWNagr.mGA--&rand=-1131022177&count=10&seq=1&format=json&IM=2x5A0IOr9Js_8er8BgSYUCB9fjB.d20FbKds7NdJdkzWK4u2A92k5dMrM72OetLz9.q70NQCwZpAqafQ5.XM-|QTvOT1rY3ukBC8o4Z0zeRg--&oauth_consumer_key=dj0yJmk9cFNKb2NKbTdINEtFJmQ9WVdrOVpHMW1aVXhKTjJNbWNHbzlNamcyTnpNMU1UWXkmcz1jb25zdW1lcnNlY3JldCZ4PWJh&oauth_nonce=939bc51c9a594c7cbf903643bc10f7d1&oauth_signature_method=PLAINTEXT&oauth_timestamp=1328108171163&oauth_token=A%3DosG_yqL.hxped9sV4ZMVD2A5vugclvEOSKIw85DOg17vQa8N1jQK6UcGqeLGLXKFalrxnYA_iA_ArmhbN6oJ_CEINGwiq7MWsVjO_vQT5bwhmcBMwBLByhusduuH2BFJw1Zd2w_uDj5fEUVMK9bMDzg.fYEpdm1uK.OgwyYLPCwdkzW0w6ujPpaFAea7gwmsSBYHECzjXm8wduoe1Sw3rpJH4z9PGIe8Hkt3wrbyJpW9BuiU4g6OyE1f8nhzHVkcG_70KQiIR_oV3tP8_l4SCsbbHMvSzlyZjK1V6gJp0Q94fAcfuIWQ1Vd.iD.UZPEyzdzYK.k5Q6pE4H3At8czcXFOpmOL5eUwfbeQEtXePCL1b2v9oY4BxtH_dCUVTMhzQsV.YpKZV.ZRZzK8ThveL5gfGuqYcBZLHwVilQnQWo477XwT10GbvWUzJ2EH4v5m9q.sGMViSIKWjbE2O6YfwhYXAgQMA3d8wQLL7IoY4QC0.IR4T8M_KnZVlKoi_EiED8VuK9h7h3emBZeXoM15rqGk2..HUJQEuIe1d0YbTPEGKdM.fbCcT7_Y0Szzw3abf9b1Xjzm8VkNSKL.LXAmy8c9PyNatUT_hKFmzmWMd1RRYfd8rF7i6i7Ec_cVv06QhwCQyKlEsCQh7UChUe9JykUmiA6JOm4JOpsbTQWS1Iec35zrltc4YwouUlMx.y6JbzB_VYL9jkzeuu&oauth_version=1.0&oauth_signature=2cd720831677df11508571218aed6c36c9cf2b51%26e57b0e111092b000a43b4ae9c928178fd5da4b9f
connection: keep-alive
cookie: IM=2x5A0IOr9Js_8er8BgSYUCB9fjB.d20FbKds7NdJdkzWK4u2A92k5dMrM72OetLz9.q70NQCwZpAqafQ5.XM-|QTvOT1rY3ukBC8o4Z0zeRg--
User-Agent: Dalvik/1.2.0 (Linux; U; Android 2.2; sdk Build/FRF91)
Host: rproxy2.messenger.yahooapis.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 0
The server responds with:
HTTP/1.1 403 bad IM cookie or URI credentials
Connection: close
I followed all the instrunctions from docs, not sure how can make it to work.
Thanks.
Your HTTP POST is empty (Content-Length: 0), the docs state:
Note: even though all inputs are optional, the server
still expects an empty POST body (JSON: "{}")
so, change your Content-Type to "application/json;charset=utf-8" and include
{}
as the body of the HTTP POST.
Long lived connections need to be GET calls; see "Notification Management (Comet-Style Push) API", here.

Categories

Resources