Closed mrqaidi closed 2 years ago
Hi, I haven't tested the gomotive api, but as far as I see it should work. According to the api docs it uses OAuth 2.0 with Authorization code grant, which is the one used by this plugin. Make sure you properly set:
authorizationEndpointUrl
tokenEndpointUrl
clientSecret //this is optional and should not be used if you are going to use the api from an app
clientId
redirectUrl
scopes
hi,
everything set correctly according to api doc . also i get login flow and request permissions but on redirect to my server i get no logs and that error on app
any idea ?
this is my code
OAuthWebScreen.start(
context: context,
authorizationEndpointUrl: 'https://api.gomotive.com/oauth/authorize',
tokenEndpointUrl: 'https://api.gomotive.com/oauth/token',
clientId: 'my client id',
redirectUrl: "https://myserver/api/gomotive/auth/callback/",
scopes: ["vehicles.read", "eld_devices.read", "hos_logs.hours_of_service","hos_logs.available_time","locations.vehicle_locations_single"],
refreshBtnVisible: false,
clearCacheBtnVisible: false,
goForwardBtnVisible:false,
goBackBtnVisible:false,
onSuccess: (credentials) {
log(credentials);
setState(() {
authResponse = getPrettyCredentialsJson(credentials);
});
},
onError: (error) {
log("error");
log(error);
setState(() {
authResponse = error.toString();
});
},
onCancel: () {
setState(() {
authResponse = 'User cancelled authentication';
});
});
@mrqaidi I should have to debug it with real data to check what's failing. I presume the failure is on the onSuccess
callback in the base_oauth_flow_mixin.dart
specifically I presume in the line 76:
final client = await authorizationCodeGrant.handleAuthorizationResponse(parameters);
That's the final request to get the credentials, and it's done bye using what is received in the redirect URI params.
Try to debug the code specifically in the onSuccess
callback, or you can share (private or public if is not sensitive data) the set of data to use for testing and I can debug it.
@luis901101 thanks for your time
i think issue is with api gateway i tested with postman
i got this error after permission accept (redirect )
403 ERROR
The request could not be satisfied.
This distribution is not configured to allow the HTTP request method that was used for this request. The distribution supports only cachable requests. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
Generated by cloudfront (CloudFront)
Request ID: vqWUQen4adOhmFWzF2KjpO5M7PrxPdd8_7Uj0J3fQrNEA3kz_-CaSw==
do you think issue with them ?
about data i can give you api but you need an account to test unfortunately i got an account from my client and i have to request permission to give to you
Hmm, then try to test the OAuth authorization/authentication flow with some tool, and once you check it works fine, then try with this plugin. Glad to help.
@luis901101
adding parameter basicAuth:false to AuthorizationCodeGrant fixed my issue would be awesome if you can make that parameter changeable
@luis901101
adding parameter basicAuth:false to AuthorizationCodeGrant fixed my issue would be awesome if you can make that parameter changeable
Yeah no problem, I will add it soon and release a new version.
@mrqaidi done, check latest version v3.1.0+11
Youre welcome
hi
i am getting this error . dont know why any help ?
OAuth authorization error (invalid_request): The request is missing a required parameter, includes an unsupported parameter value, or is otherwise malformed..
my oauth 2.0 url is like this
https://api.gomotive.com/oauth/authorize?client_id=&redirect_uri=&response_type=code&scope=