I am doing a fetch to the slack.com/api/users.info method using:
return await fetch('https://slack.com/api/users.info?token=' + process.env.SLACK_AUTH_TOKEN + '&user=' + slackUserId + '&pretty=1', { method: 'POST' })
The slack user id is correct and shows the same as I can see when clicking my profile in the Slack app, yet the Slack API can not find my user, as I get error: { ok: false, error: 'user_not_found' }.
This is the first time I have this problem, it worked before, but I did not do any changes in the code.
{ token: 'xxx',
team_id: 'xxx',
api_app_id: 'xxx',
event:
{ client_msg_id: 'xxx',
type: 'message',
text: 'test',
user: 'UE8DHTXXX', // User id here
ts: 'xxx',
channel: 'DK037CXXX',
event_ts: 'xxx',
channel_type: 'im' },
type: 'event_callback',
event_id: 'xxxxxxxxx',
event_time: 1559808987,
authed_users: [ 'xxxxxxx' ] }
Error: { ok: false, error: 'user_not_found' }
Related
Full error: NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.
Why I got first time, but not second when sharing file?
const shareData = {
files: [
new File([buffer], `${imgId}.mp4`, {
type: "video/mp4",
}),
],
title: "Megosztom",
text: "Mentsd le a képekbe, és oszd meg storyban.",
};
navigator
.share(shareData)
.then(() => {
log(
{
text: `'The share was successful 1 ` + getTempUserShortId(),
},
env
);
})
.catch((error) => {
log(
{
text: `There was an error sharing 1 ${error} ` + getTempUserShortId(),
},
env
);
});
Using Google OAUTH service to send an email using nodemailer. It works in the local environment (windows), but not in production (AlmaLinux OS).However, gave me an "504 XOAUTH2 authentication mechanism not supported" error in production environment.
Any suggestions would be greatly appreciated. Thanks
Code:
const transporter = nodemailer.createTransport({
service: "gmail",
auth: {
type: "OAuth2",
user: "test#gmail.com",
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRECT,
refreshToken: process.env.GOOGLE_REFRESH_TOKEN,
accessToken: googleToken
},
tls: {
rejectUnauthorized: true
},
})
const mailData = {
from: "test#gmail.com",
to: emailDetails.to,
subject: emailDetails.subject,
// text: emailDetails.message,
html: `<div>${emailDetails.message}</div>
`
}
// console.log(JSON.stringify(mailData));
transporter.sendMail(mailData, function (err, info) {
if(err){
console.log(err)
res.send({status: 0, message:"Error occured", errors: [{code: "", message: err}]});
} else {
console.log(info)
res.send({status: 1, message:"successfully send an email", errors: []});
}
transporter.close();
})
}).catch(error => console.log(error));
][1]
Error message output here:
enter image description here
I have this Facebook strategy:
facebook: {
access_token_endpoint: 'http://***.**/api/v0/auth/social',
access_type: 'offline',
client_id: '*******',
grant_type: 'authorization_code',
redirect_uri: socialLoginUrl + '/account/aanmelden',
response_type: 'code',
token_key: 'jwt',
userinfo_endpoint: 'https://****.***.**/user/profile'
},
When I try to register with Facebook I get the following form in the request:
code: **
client_id: **
redirect_uri: **
response_type: **
grant_type: **
I want to supply some data to the back-end when I register:
"attributes":{
"code":"*****",
"vendor":"Facebook"
},
How do I add this to the form that's being sent to the access_token_endpoint ?
// updated question.
Calling the loginWith function:
#click="$auth.loginWith('facebook', { params: data })"
data object:
data () {
return {
data: {
type: 'user',
attributes: {
vendor: 'Facebook',
code: '**'
}
},
}
},
Request payload in the browser:
code=**&client_id=**&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Faccount%2Faanmelden&response_type=code&grant_type=authorization_code
Response from the back-end:
I expect the data object to be available in the payload, but I'm not sure if I'm doing this correctly.
From the official docs, it looks like you can do
this.$auth.loginWith('facebook', { params: { /* additional authentication parameters */ } })
.then(() => this.$toast.success('Logged In!'))
I never used it with Facebook but it's working great with local (using JWT).
The related part of the documentation: https://auth.nuxtjs.org/api/auth#loginwithstrategyname-args
I implemented Facebook login for both Android and iOS using react-native-facebook-login. I followed all of the instructions and it is working perfectly on Android. It works on iOS, but the response does not contain profile data.
Android Response:
declinedPermissions: [],
provider: 'facebook',
profile:{
id: '121212121212121212',
name: 'XYZ',
email: 'xyz#gmail.com',
first_name: 'XYZ',
last_name: 'XYZ',
age_range: { min: 21 },
link: 'https://www.facebook.com/app_scoped_user_id/121212121212121212/',
picture: { data: { is_silhouette: false,url: 'https://scontent.xx.fbcdn.net/v/t1.0-1/12/12.jpg?oh=12&oe=12' } },
gender: 'male',
locale: 'en_US',
timezone: 5.5,
updated_time: '2017-02-01T08:16:35+0000',verified: true },
type: 'success',
credentials: {
permissions: [ 'public_profile', 'contact_email', 'user_friends', 'email' ],
tokenExpirationDate: '2017-05-13T14:56:36.690+0530',
userId: '1212121212121212121',
token:'ababababababababbababababa' }
But on iOS, the response is incomplete and there is no profile data:
declinedPermissions: [],
credentials: { tokenExpirationDate: '2017-05-14T14:58:09+05:30',
permissions: [ 'email', 'contact_email', 'user_friends', 'public_profile' ],
userId:'12121212121212121',
token:'abababababababababababababa' },
missingPermissions: []
The code is same for both Android and iOS. And I did all of the configuration changes in Xcode. Is there something else that needs to be done to get the profile data on iOS?
We need to do another API call where we send the token which was generated into this API call.
fetch('https://graph.facebook.com/v2.5/me?fields=email,name,first_name,last_name,friends&access_token=' + YOUR_GENERATED_TOKEN)
.then((response) => response.json())
.then((json) => {
})
.catch(() => {
reject('ERROR')
})
This call will give you the profile details.
I'm trying to use Google's 'google-api-nodejs-client' package (https://github.com/google/google-api-nodejs-client) to handle OAuth 2.0 authentication.
I've modified the example in examples/oauth2.js to console.log the entire profile object.
What scope can I use to correctly extract users' 'givenName' and 'familyName' if they're authenticating using a Google Apps account? Using the following scope:
scope: [
'https://www.googleapis.com/auth/plus.login',
'https://www.googleapis.com/auth/plus.profile.emails.read'
]
returns the following response once authenticated:
{ kind: 'plus#person',
etag: '"LONG STRING"',
emails: [ { value: 'example#example.example', type: 'account' } ],
objectType: 'person',
id: '123456',
displayName: '',
name: { familyName: '', givenName: '' },
image:
{ url: 'https://lh3.googleusercontent.com/ etc etc',
isDefault: false },
isPlusUser: false,
language: 'en_GB',
circledByCount: 0,
verified: false,
domain: 'example.example' }
I tried fooling around with the API on the API Explorer (https://developers.google.com/apis-explorer/#p/plus/v1/plus.people.get?userId=me) and only needed the 'https://www.googleapis.com/auth/plus.login' scope to get my familyName and givenName.
Perhaps the user that you are requesting the data from does not have a given and family name set?