Facebook OAUTH Server-side authentication fails - authentication

Following the server-side authentication proceedures defined here: https://developers.facebook.com/docs/authentication/server-side/.
Ran this command:
https://www.facebook.com/dialog/oauth?client_id=xxxxxx&state=you&redirect_uri=http://lovers.net&scope=ads_management,offline_access
Which results in this:
=">http://lovers.net/?state=you&code=AQA7c30iVuCyDJzlKP8-9z_Rv7JhpnHEEfsiT5doge1TL--WSXdK9NjCl7q7_Ldovrc9SrlaOZe9VzS1pvelthA2hD72Q5aTVjFlviNPuQJ1U3LP16e7zY7lI5avSlcL1wZoOYYi5JeoOsPwe9HaeQvtfBQSYVX2WQCbo2tVFYboSq1_FNSHOpAKsaW86-1IJM#=
Which I turn into this:
=">https://graph.facebook.com/oauth/access_token?client_id=xxxx&redirect_uri=http://lovers.net&client_secret=xxxxx&code=AQA7c30iVuCyDJzlKP8-9z_Rv7JhpnHEEfsiT5doge1TL--WSXdK9NjCl7q7_Ldovrc9SrlaOZe9VzS1pvelthA2hD72Q5aTVjFlviNPuQJ1U3LP16e7zY7lI5avSlcL1wZoOYYi5JeoOsPwe9HaeQvtfBQSYVX2WQCbo2tVFYboSq1_FNSHOpAKsaW86-1IJM#=
Which results in this:
{
"error": {
"message": "Error validating verification code.",
"type": "OAuthException",
"code": 100
}
}

Most likely you've specified a different value for the redirect_uri parameter in the call to /oauth/access_token as you did when you sent the user to the auth dialog - this is the case in the example you've posted in the question, so check it's not also the case in your code.

Related

Strapi API register returning a 400 error

I’ve been creating a web app with a login and a registration function and so far everything has been going great. I managed to connect the app to the api/auth/local api endpoint and send some nice post requests.
Now, I’ve been trying to send requests to the http://localhost:1337/api/auth/local/register endpoint and without any success. I’ve been doing this according to:
https://docs.strapi.io/developer-docs/latest/plugins/users-permissions.html#registration
I keep getting a 400 error:
{
"data": null,
"error": {
"status": 400,
"name": "ApplicationError",
"message": "An error occurred during account creation",
"details": {
}
}
}
If I try to send a request with an email that’s already registered in strapi, the response will give me the correct error:
{
"data": null,
"error": {
"status": 400,
"name": "ApplicationError",
"message": "Email is already taken",
"details": {
}
}
}
In the public and authenticated user roles, I’ve allowed every single one of them, for now.
Enable confirmation emails are set to false.
Email confirmation
Public user permission
For the headers, I’m using Content-type : application/json
the raw json body I'm posting:
{
"email": "manager1#strapi.io",
"password": "testtest1",
"username": "manager1"
}
This is my first project with strapi and so far it went pretty well. I’m not sure if I’m missing out on something or if I’m doing something else wrong.
Any help is appreciated!
I figured it out, it wasn’t as complicated as I expected.
In the user I had different fields, like firstName, lastName etc. All of these fields were required.
I made the fields not required, and now it works.

Auth0 API Create User returns Client ID Not Found

I am using the Auth0 Management API page to test creating a user.
https://auth0.com/docs/api/management/v2#!/Users/post_users
I am sending the following body to POST:/api/v2/users:
{
"email":"me#test.com",
"password":"123DEDed1!",
"connection":"My-Users"
}
However I get the following response:
{
"statusCode": 400,
"error": "Bad Request",
"message": "Sandbox Error: Client: '{{REDACTED}}: Client id not found'"
}
Obviously the client ID does exist. Any ideas what I am doing wrong?
We found the issue was actually internal to another script we had configured in the Action Login Flow

google translate API authorisation problem

I am trying to translate some text using GCP translation service with REST api https://translation.googleapis.com/v3
I'm using API key auth method.
url and
Body
https://translation.googleapis.com/v3/projects/my-translator-1122333:translateText?key=thisismykey
{
"content": ["Hello"],
"sourceLanguageCode": "en",
"targetLanguageCode": "ru"
}
However I got
{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"status": "UNAUTHENTICATED"
}
}
Could anyone explain me what is wrong I do?
Thanks

Firebase rule auth.token.email is not working: "Simulated write denied"

https://firebase.google.com/docs/reference/security/database/#authtokenF
{
"rules": {
"c":{
".write":"newData.child('email').val()=== auth.token.email"
},
}
}
Always it showing "Simulated write denied"
How to solve this problem ? Is there any mistake with my firebase rule
It looks like you're not providing an email address in the authentication data.
When you select a provider, the simulator shows the exact auth.token payload that it will use. For the Google provider my Auth token payload looks like this:
The simulator takes the literal JSON that is shown in here, and uses it as auth.token.
{
"provider": "google",
"uid": "27e08474-4e33-460d-ba92-ba437c6aa962"
}
Since there is no email provided, your rules (correctly) fail.
For testing this scenario, you'll want to switch to a custom provider, so that you can specify your own auth token with an email property:

google plus auth returning error 401

I am using Google plus auth to log in in web application. It is working properly, but for some time its return error 401. Error JSON is following. I view link Error Description but I did not understand what should I do.
{
"error":
{ "errors":
[
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Invalid Credentials"
}
}
As the error page indicated - your access token has likely expired. It sounds like you got an access token once, and are continuing to use it.
Access tokens expire after an hour. After that time, you either need to go through the auth flow again, or use the refresh token to get a new one.