You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, now I need my customers login with twitter then add them as parse users.Because there is no function I can use as twitter logining in ParseUser.php, so I write one:
publicstaticfunctionlogInWithTwitter($id, $access_token, $expiration_date = null)
{
if (!$id) {
thrownewParseException("Cannot log in twitter user without an id.");
}
if (!$access_token) {
thrownewParseException(
"Cannot log in twitter user without an access token."
);
}
if (!$expiration_date) {
$expiration_date = new \DateTime();
$expiration_date->setTimestamp(time() + 86400 * 60);
}
$data = json_encode(['authData' =>
["twitter" => [
"id" => $id, "access_token" => $access_token,
"expiration_date" => ParseClient::getProperDateFormat($expiration_date)
]]
]);
$result = ParseClient::_request("POST", "/1/users", "", $data);
$user = newParseUser();
$user->_mergeAfterFetch($result);
$user->handleSaveResult(true);
ParseClient::getStorage()->set("user", $user);
return$user;
}
But when I finished login with twitter, error occurs: Code : 251 Message:Twitter credential verification failed.. I try to look for solutions, but all I found are things about apps platform problems, and they can fix if by setting consumerKey and consumerSecret in TWSignedRequest. But I don't know whether I need to set twitter consumerKey and consumerSecret, if I need to do this ,where should I set?
{
"twitter": {"id":"user's Twitter id number as a string","screen_name":"user's Twitter screen name","consumer_key":"your application's consumer key","consumer_secret":"your application's consumer secret","auth_token":"an authorized Twitter token for the user with your application","auth_token_secret":"the secret associated with the auth_token"
}
}
Anyone still interested in this? I imagine we'll be putting this in at some point this year given that support for this (and many more alt logins) has been setup on Parse Server's end. I'm on the project as a maintainer so we can keep things moving along here after Parse shuts down.
A twitter login helper has now been added to the sdk. In addition general purpose login/linker methods have been setup in ParseUser, this will allow us to add further 3rd party auths as needed.
You can login/link with twitter as follows now:
// login with twitterParseUser::logInWithTwitter(
'user_id',
'screen_name',
'consumer_key',
'consumer_secret', // this is optional'auth_token',
'auth_token_secret'
);
// **MAKE SURE your parse server has the 'auth' option // properly configured for twitter auth to work **// vvv Check out the link below for info on this vvv// http://parseplatform.org/docs/parse-server/guide/#oauth-and-3rd-party-authentication// login or signupParseUser::logIn('username', '************');
// link the current userParseUser::linkWithTwitter(
'user_id',
'screen_name',
'consumer_key',
'consumer_secret', // this is optional'auth_token',
'auth_token_secret',
$useMasterKey// again optional, will default to false
);
Again here's a link for configuring 3rd party auth in parse server. Make sure to do this before you try to run twitter auth from the sdk.
If there's a desire to add any additional auths be sure to open up an issue or a PR with the relevant additions and we'll take a look. You can find all of the current auth options within parse server here. Among them there are some auths such as github, google, instragram, linkedin, spotify and more.
We'll probably look into adding these and more as time goes just for good measure, but be sure to let us know if you want to have these integrated sooner.
Awesome! I'm not sure you need to integrate them all now, as the server should be able to understand requests as long as the auth adapter is configured correctly on the other side.
@flovilmart we'll probably add them as demand requires, we should be good for now though. If anything I'm curious how the other sdks are keeping up with these new integrations. I also took the liberty of updating that last comment I left with some more details in regards to using 3rd party auth.
Activity
zEmily commentedon Jun 13, 2015
Right now I add customer key to parse settings, but the error also occurs .
sherizan commentedon Jun 13, 2015
I'm doing the longer method. Sign in via Facebook/Twitter, get his session fb, redirect to a new page, set password and set as a new user on Parse.
zEmily commentedon Jun 13, 2015
@sherizan I have found the right way to add twitter login user as parse user. You can check this https://parse.com/docs/rest/guide/#users-signup and search for twitter, you'll see this:
{ "twitter": { "id": "user's Twitter id number as a string", "screen_name": "user's Twitter screen name", "consumer_key": "your application's consumer key", "consumer_secret": "your application's consumer secret", "auth_token": "an authorized Twitter token for the user with your application", "auth_token_secret": "the secret associated with the auth_token" } }and it works!
gfosco commentedon Jun 15, 2015
Glad you figured out a way to do it using _request :) I'll leave this open though, because we should add a native method as we did for Facebook login.
[-]Can I login with twitter then add the user to parse[/-][+]Todo: Add Twitter login helper.[/+]raed667 commentedon Jul 28, 2015
+1
murnieza commentedon Jan 14, 2016
Any news on this one?
talkaboutdesign commentedon May 5, 2016
Anyone working on this?
talkaboutdesign commentedon May 18, 2016
Would be awesome if you can do this as part of the framework.
raed667 commentedon May 19, 2016
@talkaboutdesign With everything going on with Parse, I wouldn't expect any updates.
montymxb commentedon Jan 13, 2017
Anyone still interested in this? I imagine we'll be putting this in at some point this year given that support for this (and many more alt logins) has been setup on Parse Server's end. I'm on the project as a maintainer so we can keep things moving along here after Parse shuts down.
vferdiansyah commentedon Mar 28, 2017
Just submitted a PR #297 for this. Could you help review it @montymxb?
montymxb commentedon Mar 31, 2017
A twitter login helper has now been added to the sdk. In addition general purpose login/linker methods have been setup in
ParseUser, this will allow us to add further 3rd party auths as needed.You can login/link with twitter as follows now:
Again here's a link for configuring 3rd party auth in parse server. Make sure to do this before you try to run twitter auth from the sdk.
If there's a desire to add any additional auths be sure to open up an issue or a PR with the relevant additions and we'll take a look. You can find all of the current auth options within parse server here. Among them there are some auths such as github, google, instragram, linkedin, spotify and more.
We'll probably look into adding these and more as time goes just for good measure, but be sure to let us know if you want to have these integrated sooner.
flovilmart commentedon Mar 31, 2017
Awesome! I'm not sure you need to integrate them all now, as the server should be able to understand requests as long as the auth adapter is configured correctly on the other side.
montymxb commentedon Mar 31, 2017
@flovilmart we'll probably add them as demand requires, we should be good for now though. If anything I'm curious how the other sdks are keeping up with these new integrations. I also took the liberty of updating that last comment I left with some more details in regards to using 3rd party auth.
flovilmart commentedon Mar 31, 2017
we technically still need to make those methods public in the JS SDK, but the mechanisms are open on iOS.
parse-github-assistant commentedon Dec 6, 2021
The label
type:featurecannot be used in combination withtype:improvement.