callback url wont work in twitter - twitter

i m login via twitter and then it said redirecting you to the application , this may take few moments in a popup page then it redirect to a blank page with that url
http://www.mywebsite.com/rafgallery/callback.php?type=twitter&oauth_token=***************&oauth_verifier=************
what can be wrong please ,?
in the twitter app setting i have callback url like that
http://www.mywebsite.com/rafgallery/callback.php?type=twitter
whats wrong please ? is the url wrong or what ?

The oauth_callback parameter is sent as part of the call for a request token to the request token endpoint: (https://api.twitter.com/oauth/request_token).
The call to the authenticate endpoint is then made with just the request token you receive back.
Have you tried removing the oauth_callback parameter from the authenticate url?
See the Twitter docs for more information.

i get it to work with that link
http://www.mywebsite.com/rafgallery/callback.php?type=twitter
in really i created new API keys and it worked, i dont know what was wrong with the first API KEYS.

Related

Devise Omniauth : POST data using href link

I would like to create a link that could POST data.
Actually, I have a front in vuejs and a backend in rails.
I already have my own authentication system with Devise gem.
And I would like a user (who is already logged in) to be able to connect to other omniauth services (github, google...).
The problem is that as soon as I go on the link /auth/github (for example) my backend tells me that I didn't send the user's authentication token because i don't know how to send it.
That's why I would like to send datas (here, the auth token) directly from the link
Thanks
Like #Eyeslandic pointed out, your title is misleading, you have an OAuth or OAuth2 problem not a link problem.
If I can guess correctly you are getting a Get response (the token is in the link) and you want it to be a post response (the token in the request body) ... Are you using passport.js ? Must be a matter of configuration.
There is nothing wrong with receiving the token in the link, OAuth protocols are secure enough, whether it's a Get or a Post response.
If you want to read the token from the link, check this answer.
login.get('/p', function(req, res) {
const token = req.query.theReturnedTokenNameInTheLink
res.send("My token is " + token);
});
And the token is just a key that give you access to the host (github, google, facebook ...) Api, you should make another request to those API's, in order to get the user data, you could use a library like passport.js to simplify things, here is one of the tutorials, I found on how to use passport.js
Good luck.

Generating Linkedin Access Token

I have been trying with the simple REST Client as well as the REST Plugin for Mozilla. I am getting
"HTTP/1.1 401 Unauthorized" response with
"{"error":"unauthorized_client","error_description":"the client is not authorized"}" in the body.
I have been successful in getting the auth code, and the below is the POST request for access token, (Scope is r_fullprofile)
https://www.linkedin.com/uas/oauth2/accessToken?grant_type=authorization_code&code=AQTQeBxBzbU2aNWaQM6Ff3Z3bUd8Gyg10W9G2DdqXgWiP0q7-M55c5PLtppP7Ni3Y-6A9C8yDkj9K4VfJ7QkRUFjuV-3AknA5jAahpsFJv3wYfr8XD8&redirect_uri=https://www.google.com&client_id=75wl6j5zndvfkp&client_secret=secret
The redirect_uri=https://www.google.com is the one used for getting auth code as well.
Do we need to perform any URL encoding before making the POST request?
When I log into the linked in to my app, it has the below tokens,
OAuth User Token: c3ae4cee-1b23-xxx-9d2a-206f578dee4d
OAuth User Secret: 76bc48cc-c94f-xxx-bf9d-a663f7003383
I am not sure where it is used. we are using API & secret key to get auth code.
Thanks in Advance.
This is a 2-step process.
First, go to:
https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=YOUR-API-ID&scope=r_basicprofile&state=STATE&redirect_uri=YOUR-ENCODED-REDIRECT-URI
Then, within 10 secs of receiving the response, go to:
https://www.linkedin.com/uas/oauth2/accessToken?grant_type=authorization_code&redirect_uri=YOUR-ENCODED-REDIRECT-URI&client_id=YOUR-API-ID&client_secret=YOUR-API-ID&code=THE-CODE-OBTAINED-IN-FIRST-STEP
The response of the second request will have the actual access token you need to use.
When I followed the two steps I faced an issue where I got an error as
{"errorCode":0,"message":"Access to posting shares denied","requestId":"TYWULO2WPZ","status":403,"timestamp":1497353538016}
So I had to remove the &scope=r_basicprofile since it was preventing reading all the Default Application Permissions
I faced a similar problem and the problem was with the initial authorization code. You should mention the scope=rw_company_admin or whatever it is that you want to authorize to while doing the initial redirect URL call. Something like this -
https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=your_client_id&redirect_uri=https%3A%2F%2Fwww.google.com/&state=12345&scope=rw_company_admin%20r_emailaddress%20w_share%20r_basicprofile

retrieving Instagram access_token via api in c# a

In order to make request to the instagram api. I require an access token.
Which is documented here.
http://instagram.com/developer/authentication/
These access token can change so i need to lookup via the api to get the "code" and then the access token. Most of the examples i see online prompt the user to instagram which then calls the callback url and off you go and generate the access_token.
How can i via the api ( and not logging into instragram ) get the inital "code"/
I was hoping for something like this.
var accessUrl = string.Format(
"https://instagram.com/oauth/authorize/?client_id={0}&redirect_uri={1}&response_type=code",
instagramClientId, redirectUrl);
WebRequest request = WebRequest.Create(accessUrl);
WebResponse response = request.GetResponse();
To be clear I'm not asking how to get the access_token but how do I get the "code" than generates the access_token without logging into instagram
code is appended as a url querystring in a GET request that Instagram sends to your callback url.
For example, if your callback url is:
http://www.mycallbackurl.com/callback
Instagram (upon receiving your access_token request) will send a GET call to:
http://mycallbackurl.com/callback?code=20938409823kjl2k3j4o998as0df809s80980234809
(it's base64 encoded).
You then need to capture that url parameter on your callback server and echo it out on the page (nothing else, only the value of the code parameter), resulting in something like:
<html>
<body>20938409823kjl2k3j4o998as0df809s80980234809</body>
</html>
This can be done easily with php:
if (isset($_GET['code']))
echo $_GET['code'];
else
//do all the other stuff your page does
Hopefully if you're not using PHP you can discern how to accomplish the same result. This part of their authentication flow is rather poorly documented, but hopefully this helps.
Also: (Not sure if I understand this part of the question or not, but) the only authentication flow they allow is the in-browser login page. If you're trying to build your own custom login and pass credentials, it won't work.

Doing a POST request to twitter

I'm having problem creating the POST request (to tweet) in twitter.
I dont want to use any library.
I have all the oauth required parameters but still unable to do a valid request
when i'm doing
curl "https://api.twitter.com/1/statuses/update.json?oauth_signature=NCs%2B1unOYZQW%2BNCTmsRwmiqtrZQ%3D&oauth_version=1.0&oauth_nonce=-619997894&oauth_signature_method=HMAC-SHA1&oauth_consumer_key=gGrr4khdilkzano8gYxK4Q&oauth_token=146439820-n07FzSB78bDWEUzPPP9WZnwdnwW917FyJi1gwKWM&oauth_timestamp=1341309839" -d 'status=hello'
then i'm getting
"Could not authenticate you.","request":"/1/statuses/update.json"
I know that the OAuth parameters are right coz i'm able to do GET request like
https://api.twitter.com/1/statuses/public_timeline.json?oauth_signature=NCs%2B1unOYZQW%2BNCTmsRwmiqtrZQ%3D&oauth_version=1.0&oauth_nonce=-619997894&oauth_signature_method=HMAC-SHA1&oauth_consumer_key=gGrr4khdilkzano8gYxK4Q&oauth_token=146439820-n07FzSB78bDWEUzPPP9WZnwdnwW917FyJi1gwKWM&oauth_timestamp=1341309839
and its working just fine.
So please help me to resolve the issue.
Your second request works because it doesn't require authentication.
When you have to authenticate a request, you should do this with a HTTP header called Authorization as described here : https://dev.twitter.com/docs/auth/authorizing-request

Twitter Integration in Blackberry: Login Page not in English

I am trying to integrate twitter using Twitter Api me 1.8 . When i try to authorize using OAuth the login Screen look like below .Some invalid charecters are showing.please help me to identify the problem
thanks
Try with BIS. It works fine with BIS. Else you can call HTTP GET and POST methode to the following urls.
For request token call https://api.twitter.com/oauth/request_token (HTTP GET with key , secret, and signature).Then you will get the request token
For Authorization call this link in your browser https://twitter.com/oauth/authorize?oauth_token=your request token
For access token call https://twitter.com/oauth/access_token (HTTP POST with key , secret, signature , token) . Then you will get the access token and secret.
If the login page content is not displayed properly in BlackBerry, then follow this link.
Please, use BrowserFieldOAuthDialogWrapper in place of BrowserContentManagerOAuthDialogWrapper class. It works fine for me.
http://kenai.com/projects/twitterapime/forums/forum/topics/523812-A-test-for-invalid-characters-on-Blackberry#p571144
I got this success by the help of #ernandesmjr Ernandes Mourao Jr
If any find any issue. please let me know.

Resources