Closed anakin001 closed 1 year ago
@anakin001 Thanks for the comments
In uae_pass_method_channel.dart: line 49:auth_token -> access_token this has not been resolved
I created another method for that
Once you receive the access auth token, better to use this method to convert to auth code to the access token. Both android and iOS work differently.
curl --location --request POST 'https://stg-id.uaepass.ae/idshub/token?grant_type=authorization_code&redirect_uri=https://stg-selfcare.uaepass.ae&code=bfe96299-83f4-3ee9-80e4-56c24f5265d3' \
--header 'Content-Type: multipart/form-data' \
--header 'Authorization: Basic c2FuZGJveF9zdGFnZTpzYW5kYm94X3N0YWdl'
Both android and ios behave differently
Android to get auth token we need call the sign in again ios It converts the auth code token token directly
For a best approach do it on the flutter by using dio/http package or server side.
Once received the auto code you can convert it by hitting the POST method Refer here.
This is my code, Ive tested in android, I managed to get the user info. Not sure if it works on IOS
Don't use the _usePassPlugin.getAccessToken()
instead use
final FormData formData = FormData.fromMap({
"grant_type": "authorization_code",
"redirect_uri": "https://stg-selfcare.uaepass.ae",
"code": "bfe96299-83f4-3ee9-80e4-56c24f5265d3"
});
String username = 'client_id';
String password = 'client_secret';
String basicAuth =
'Basic ${base64.encode(utf8.encode('$username:$password'))}';
Dio().post("https://stg-id.uaepass.ae/idshub/token",
data: formData,
options: Options(headers: {"Authorization": basicAuth}));
Don't use the _usePassPlugin.getAccessToken()
instead use
final FormData formData = FormData.fromMap({ "grant_type": "authorization_code", "redirect_uri": "https://stg-selfcare.uaepass.ae", "code": "bfe96299-83f4-3ee9-80e4-56c24f5265d3" }); String username = 'client_id'; String password = 'client_secret'; String basicAuth = 'Basic ${base64.encode(utf8.encode('$username:$password'))}'; Dio().post("https://stg-id.uaepass.ae/idshub/token", data: formData, options: Options(headers: {"Authorization": basicAuth}));
thanks @faisalkcmvp
Is it normal that I dont get a refresh token in response? Or it's not available in staging?
Am not sure about that, At this stage, you need an access_token to get the user info.
Note:
client: sandbox_stage secret: sandbox_stage
from the official doc then, After approvels you will get another one.
In uae_pass.dart: line 11: remove '://' line40: getAuthToken -> getAccessToken In uae_pass_method_channel.dart: line 40: getAuthToken -> getAccessToken line 41:auth_token -> access_token In uae_pass_platform_interface.dart: line 35 & 36: getAccessToken