I'm building a login component in my react-app using react-facebook-login, but I can't get the user's email (or the birthday... or the gender...)
I'm implementing it like this:
<FacebookLogin
appId="<<APP_ID>>"
autoLoad={this.state.facebookLoad}
fields="first_name, last_name, email, picture, birthday"
scope="public_profile, email, user_birthday"
returnScopes={true}
callback={this.facebookResponse}
onFailure={() => this.fbhandleFailure()}/>
I'm being specific with which fields I need, and also with the scope... But for some reason I think the scope is being ignored. I checked with https://developers.facebook.com/tools/explorer/ and it shows me two debug messages:
Debug messages
Can anyone help me?
Thank you very much.
use this link(https://developers.facebook.com/tools/explorer/) and Get Token -> Get user access token -> check whatever you need under 'User Data Permissions' eg 'email'
Related
I have a simple React application and I would like to create a form that sends an email to a specific Outlook adress without having to add my own backend.
I first looked at email.js, a library that works fine for Gmail but not for Outlook in my case. When I try to set up the correct Email, I get:
412Hotmail: Invalid login: 535 5.7.139 Authentication unsuccessful, SmtpClientAuthentication is disabled for the Tenant. Visit https://aka.ms/smtp_auth_disabled for more information. [MW4PR04CA0143.namprd04.prod.outlook.com]
This leads into a maze of powershell commands that, for reasons that are hard to summarize, were very difficult to follow through and actually make it work.
I then tried using https://www.smtpjs.com/, but I can't make it work with React. The following code:
Email.send({
Host : "smtp.yourisp.com",
Username : "username",
Password : "password",
To : 'email#email.com',
From : "you#isp.com",
Subject : "This is the subject",
Body : "And this is the body"
}).then(
message => alert(message)
);
gives the error that "Email is not defined", it doesn't matter where I insert my script tag, in my component or in index.html. I also tried
const script = document.createElement("script");
script.src = "https://smtpjs.com/v3/smtp.js"
inside the component, still does not work.
The only solution that actually works so far is https://formspree.io/, but it is a sub-par solution where the sender is redirected to a Formspree page.
I have a very vague understanding of SMTP, so perhaps I am making some rookie mistake with smtp.js.
Grateful for any help.
I'm currently working on revising the registration procedure of our recruitment ATS, made with AngularJS and Meteor, and I need to verify the new user's email during the registration procedure.
The logic would go as followed:
1- User fills in a form on the 'get-started' page and when clicking on 'sumbit', the ATS sends a verification email(I'll be using 'sendVerificationEmail' from Meteor)
2- After the user clicks on the link from the email, they'll get redirected to the 'register' page where additional information is required and the registration procedure is concluded.
As mentioned above, I'm planning to use 'sendVerificationEmail' to verify the user but I also want to use it to send back the userID.
From what I read on the Meteor API, I can pass extra data to the token with 'extraTokenData'
Accounts.sendVerificationEmail(userId, [email], [extraTokenData])
Now how do I declare the 'extraTokenData' object?
Could I do it like this: Accounts.sendVerificationEmail(userId, "", { _id: userId })
And how do I retrieve the 'userId' with 'Accounts.onEmailVerificationLink'?
your help will be greatly appreciated.
The email and the extra tokens are optionals, but if you want to send them send it as a string.
If you want to send the extra token but no emails you can try using Accounts.sendVerificationEmail(userId, undefined, "extra token") or if it doesn't work you can request the user's deatil user Meteor.user(). then call user.emails[0].address.
To retrieve information you have to get user by token and all data are there on user document under services.password.reset field. Look here how Accounts.generateResetToken is implemented https://github.com/meteor/meteor/blob/1e7e56eec8414093cd0c1c70750b894069fc972a/packages/accounts-password/password_server.js#L609.
I have statistics. I am downloading from the User Id database and I am replacing the ID with its name, but if the user has left the server, there is an error because there is no such user.
I have bot.users.get(id) but when a user leaves the server, an error pops up.
Can I get the username with the ID differently if the user is not on the server?
Sorry for being late, like literally. You can perform a request to get a user from Discord by a UserResolvable with Client#fetchUser(<UserResolvable>);.
In practice, the code should look like this;
const Discord = require("discord.js");
const Client = new Discord.Client();
Client.login("YoUr.nIcE.toKe.n");
Client.on("ready", function () { // Should do that when the client is ready.
const User = Client.fetchUser("123456789012345678");
console.log(User); // Some user object.
});
Hope I helped you nonetheless.
~Q
Since client.users stores only cached users, you won't be able to retrieve their username in a reliable way from there.
DISCLAIMER: This method is really inefficient, but discord.js hasn't been made for this kind of work. If you want to make it easier, just write Unknown user (client_id)
If you're not able to get the username from a user list you could try to use messages: use channel.fetchMessages() on every channel of your guild until you find a message in which message.author.id == your_id, when you find it you can get the username with message.author.username
There's also another solution: a self-bot. Keep in mind that this one is not supported by Discord itself, and could result in a permanent ban for the account you're using.
With that said, if you use a self-bot you can use the TextChannel.search() method to quickly find a message with your author id and then grab the username from the author.
I did a lot of research, followed many different examples, but still cannot get it to run properly.
So here is a part of the controller action from the registration:
if(!empty($this->request->data)){
$this->request->data['Company']['start_date']= date("Y-m-d");
unset($this->Company->User->validate['company_id']);
if($this->Company->saveAssociated($this->request->data)){
$user = $this->request->data['User'];
$data['User']['password'] = $user[0]['password'];
$data['User']['email'] = $user[0]['email'];
if($this->Auth->login($data)){
$this->redirect($this->Auth->redirect(array('controller'=>'customers', 'action'=>'index')));
}...
So the user is saved and a new array of user's email and password is created. It is then passed to $this->Auth->login. The login seems to pass, but the following error is on redirection to customers controller:
Notice (8): Undefined index: role [APP\Controller\CustomersController.php, line 32]
Notice (8): Undefined index: role [APP\Controller\CustomersController.php, line 36]
Even though the role field is autoset as manager on user creation.
Here is how the CustomerController looks like:
public function isAuthorized($user){
if($user['role'] == 'manager'){
return true;}
if (in_array($this->action, array('add', 'edit', 'index', 'view', 'delete', 'users'))){
if($user['role'] != 'manager'){
return false;
}}return true;}
Any help is very much appreciated.
Check the docs and the source for AuthComponent::login()
http://api.cakephp.org/2.4/class-AuthComponent.html#_login
http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#manually-logging-users-in
http://api.cakephp.org/2.4/source-class-AuthComponent.html#583-606
When passing user data to AuthComponent::login(), you are logging a user in, but no authentication is going to happen! "Logging in" in this case means, the data provided is being stored in the session, and on following requests the user is being treated as logged in in case data is present in the session (in the specific key used by the component), ie you could even just pass 123456, the user would be treated as being logged in.
Authenticating on the other hand would cause a DB lookup, where all the user data would be fetched and consequently being stored in the session.
So the role field is not available because you haven't passed it to AuthComponent::login(), you've only passed email and password, consequently these are the only fields being available later on. Btw, DO NOT supply the password when doing such a manual login! You don't want to carry such sensitive information in the session!
To fix this problem, either pass the role field too, or call AuthComponent::login() without passing any data at all (make sure you are using Form authentication so that the data passed in the request is being used), so that it's going to authenticate the user and fetch its data from the DB.
See also http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html
I use the AppEngine-OAuth-Library to get user information from LinkedIn, but how do I grant for more permissions than the default basic profile.
The LinkedInClient class has this constructer:
OAuthClient.__init__(self,
LINKEDIN,
consumer_key,
consumer_secret,
"https://api.linkedin.com/uas/oauth/requestToken",
"https://api.linkedin.com/uas/oauth/accessToken",
callback_url)
I have tried this instead:
https://api.linkedin.com/uas/oauth/requestToken?scope=r_basicprofile+r_emailaddress
But it gives an Internal Server Error, when I make a request. It works perfect with the default basicprofile request. Some ideas on what is wrong?
Thanks in advance :)
You have to give additional params in the oauth.py. Where you put a dictionary with the key 'Scope' and the value should be the permission you want. If you want more than 1 permission, make a space in the value like so 'r_basicprofile r_emailaddress'