Hello,
In a lot of European countries, the app ItsMe for Android or IOS is used to sign documents, to use banking apps, etc. It works like a kind of authenticator.
Is there a way ItsMe can be implemented in a FWH-application?
Thank you very much.
Implementing ItsMe in a FWH (FiveWin for Harbour) application involves several steps, given that ItsMe is a mobile-based authentication and digital identity service. Here's a general outline of how you might approach this integration:
Understand ItsMe API:
First, you need to understand how the ItsMe API works. ItsMe provides APIs for authentication, digital signatures, and user data retrieval. You'll need to access ItsMe's developer documentation to understand the endpoints, request and response formats, and the authentication methods used.
Register Your Application:
You must register your application with ItsMe to get the necessary API keys and credentials. This usually involves creating a developer account and configuring your application in the ItsMe developer portal.
Setup Webhook Endpoint:
ItsMe often uses webhooks to communicate the result of user actions (like successful authentication). You'll need to set up a webhook endpoint that can handle these callbacks from ItsMe.
Create FWH Application Integration:
FiveWin for Harbour (FWH) is primarily used for developing desktop applications. To integrate with ItsMe, your FWH application will need to be able to make HTTP requests and handle JSON data. Harbour has libraries for handling HTTP requests and JSON.
Here is a simplified example of how you might start implementing this in FWH:
Step 1: Making an HTTP Request to ItsMe
You'll need a function in your FWH application to initiate an authentication request with ItsMe.
#include "FiveWin.ch"
#include "hbHttp.h"
FUNCTION InitiateItsMeAuthentication()
LOCAL cApiUrl := "https://api.itsme-id.com/oauth2/v2/auth"
LOCAL cClientId := "YOUR_CLIENT_ID"
LOCAL cRedirectUri := "YOUR_REDIRECT_URI"
LOCAL cState := "RANDOM_STATE_STRING"
LOCAL cScope := "profile openid"
LOCAL cAuthUrl := cApiUrl + ;
"?client_id=" + cClientId + ;
"&redirect_uri=" + cRedirectUri + ;
"&response_type=code" + ;
"&state=" + cState + ;
"&scope=" + cScope
? "Open this URL in the user's browser: " + cAuthUrl
RETURN NIL
Step 2: Handling the Redirect
When ItsMe redirects the user back to your application, it will include an authorization code. You need to capture this and exchange it for an access token.
FUNCTION HandleItsMeRedirect(cCode, cState)
LOCAL cTokenUrl := "https://api.itsme-id.com/oauth2/v2/token"
LOCAL cClientId := "YOUR_CLIENT_ID"
LOCAL cClientSecret := "YOUR_CLIENT_SECRET"
LOCAL cRedirectUri := "YOUR_REDIRECT_URI"
LOCAL hConnection := TipClientHttp():New(cTokenUrl)
LOCAL cPostData := "grant_type=authorization_code" + ;
"&code=" + cCode + ;
"&redirect_uri=" + cRedirectUri + ;
"&client_id=" + cClientId + ;
"&client_secret=" + cClientSecret
hConnection:Post(cPostData)
LOCAL cResponse := hConnection:ReadAll()
? "Token Response: " + cResponse
// Parse the response to extract the access token and other details
// Store the token for future requests
RETURN NIL
Step 3: Using the Access Token
With the access token, you can now make authenticated requests to ItsMe's API to retrieve user information or perform other actions.
Step 4: Setting up a Webhook
You'll need to set up a web server that can handle incoming requests from ItsMe. This server will need to be reachable from the internet and capable of processing the webhook payloads.
Additional Considerations
Security: Ensure that all communication with ItsMe's API is over HTTPS and that you handle tokens securely.
Error Handling: Implement robust error handling for network requests and API responses.
User Interface: Provide a seamless experience for users to interact with ItsMe through your FWH application.
This is a high-level overview, and the specifics can vary based on ItsMe's current API documentation and the exact requirements of your application. Be sure to refer to the ItsMe API documentation for detailed instructions and the most up-to-date information.
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot], karinha, Natter and 74 guests