Appauth : Authorization error: State mismatch, expecting in Swift iOS - appauth

I have Azure Sign up & login page.
If I go to Sign in then it redirecting properly and Even If go sign up then also working.
But I I click on Sign up and click on Login page then below error come.
Authorization error: State mismatch, expecting vH41GKNSEXMSdZdG-J3qUK5gy-Y07A_C__qahCmbrbs but got (null) in authorization response <OIDAuthorizationResponse: 0x600001658410, authorizationCode: (null), state: "(null)", accessToken: "(null)", accessTokenExpirationDate: (null), tokenType: (null), idToken: "(null)", scope: "(null)", additionalParameters: {
}, request: <>>
Please help us if any has faced same issue.
I have used AppAuth pod for Azure authentication.

The request may contain sensitive data (client ID), you should may not want to share it publicly.
The "state" parameter is provided in the request and is expected to be returned as is in the response. Here you have null, so AppAuth returns this error. However, as every field of the response is "null", I would say that the issue is elsewhere in your authentication setup and that the message is misleading.
I don't know much Azure authentication, I can't help you much!

Related

Issue with facebook social login : 'Invalid value for: query parameter state'

i'm encountering an issue with Facebook login, short context:
We have our auth service in scala
We use a connect.app in vuejs to call our auth service
Facebook login was working like 6 month before
i noticed that Facebook removed our API access due to lack of privacy policy link
i changed the privacy link and clicked on " restore access"
I checked AP ID and Secretkey on our env and it's correct
When i try to login with facebook, i get this message issue on click
Then when i click on "okay" i have more info about error : Invalid value for: query parameter state.
I don't know what i should do to make it works again.
Thanks in advance for your friendly help.

UBER Unable to complete Oauth process

I am working on integrating the UBER API into my app.
The first step goes fine : an Authorization url is created, the user is redirected to Uber, logs in, accepts to share the desired scope, then UBER redirects to my redirection url as provided in the dashboard and in the authorization url.
When then I make a POST request to
https://login.uber.com/oauth/v2/token
to obtain an access token
Here is the payload I send to Uber on this url
{
"code": "obtained_from_redirection_url",
"client_id": "XXXXXXX",
"client_secret": "XXXXXXX",
"redirect_uri": "https://myredirection-url.me",
"grant_type": "authorization_code",
"scope": "all_trips history history_lite places profile request request_receipt ride_widgets"
}
the response is always
{
"error": "unsupported_grant_type"
}
As you can see, the grant_type : authorization_code value is the one provided by Uber.
The scope you see here, is exactly the same as the one sent with the authorization url.
So We can at least say that the error shown does not correspond to what causes the problem, which remains a mystery to me.
I would appreciate any help.
Well the answer to this issue was that the token endpoint expects the POST request to be made with a Content-Type = x-www-form-urlencoded instead of JSON.
It is not documented in UBER's doc, and I wish it was cause it made me loose days and days seeking a solution.

"error": "unsupported_grant_type" uber rest api

I am using Uber Rest Api and trying to get access token:
Step 1:
Calling the get web API - https://login.uber.com/oauth/v1.2/authorize?client_id=gdSzxhaqFwjXly338goebrVCh_A7ND8b&response_type=code
Step 2:
URL: https://login.uber.com/oauth/v2/token
Request Body:
{
"client_secret": "xxxxxxxxxxxxxxxxxxxx",
"client_id": "gdSzxhaqFwjXly33",
"grant_type": "client_credentials",
"redirect_uri": "abc",
"code": "EBvazkPeZXbszs4MufjxA0poKUZuur"
}
and getting the response : "error": "unsupported_grant_type"
Please help me to fix the issue.
Thanks
Suresh Patel
First you should double check if you set the correct redirect url in the dashboard - needs to be the same as one on authorization url. Second your request to 'https://login.uber.com/oauth/v2/authorize' seems to contain invalid version. Please follow the steps of the authentication guide.
Briefly, you need to:
• Send user to authorize url. It starts by redirecting the user to the authorize endpoint: https://login.uber.com/oauth/v2/authorize?client_id=YOUR_CLIENT_ID&response_type=code&redirect_uri=YOUR_REDIRECT_URI .You can add scopes as well (check 'scope' parameter on authentication guide)
• Receive the redirect with an authorization code. After the user approves the scopes the user will be redirected to the redirect_uri with an auth code that you can post to the /v2/token endpoint to receive an access token.
• Make a POST call to: 'https://login.uber.com/oauth/v2/token'
• Store access and refresh token for future use
Try making your scope public.
To do that, add:
"scope: "public"
in your param

Validating the user of an access_token

In the Facebook dev article Manually Building a Login Flow, there is a section entitled "Confirming Identity". It mentions that you need to validate codes and tokens that you receive from them via your redirect_uri.
My question: Since you don't know anything about the user that just logged in, how do you validate that the user_id that you see in the response from the token inspection endpoint is correct?
The article says:
As a result, your app should confirm that the person using the app is the same person that you have response data for before generating an access token for them.
But, how can you actually do that? Are we expected to show publicly available info about that user_id back to the user with a UI that asks "Is this you?". I haven't seen any apps/sites that do that, so I'm assuming that this isn't practically done.
Am I missing something?
You can use FB.getLoginStatus to retrieve information about the logged in user. It returns a response object for the user. If the user has authenticated your application, the response object will look like this:
{
status: 'connected',
authResponse: {
accessToken: '...',
expiresIn:'...',
signedRequest:'...',
userID:'...'
}
}
You can use the UserId returned in this object to verify the user's identity.

Facebook Graph API Error (access token)

I'm getting the following error when I try to access the Graph API with my access token:
{
"error": {
"message": "Expected 1 '.' in the input between the postcard and the payload",
"type": "OAuthException",
"code": 1
}
}
I'm grabbing the access token after successfully authenticating an app I'm working on. I have accepted the permissions and I'm hitting the app's landing page. The access token doesn't look like others I've seen online. It doesn't have the '|' character in it. It does have a period and some underscores along with the typical alphanumeric combination.
I figured out the problem. The other developer I was working with used part of the raw signed_request object (not parsed) to form the access token. After taken a gander at the documentation, I quickly realized that you need to parse the signed_request object first before obtaining the oauth_token value. After that was fixed, I was able to easily make an API call.
Check to ensure you are verifying the "code" parameter returned by Facebook before signing the request, not the "access token". Signing a request with a bad access token produced this error message for me.