How to force users link phone number when they using Discourse?

I haven’t implemented it for discourse, so I don’t know exactly how to create a plugin for that, but in my implementation:

1) I already had an application in the Facebook for developers site (if you don’t have, just create one) and then just added the Account Kit product there.

2) Then I loaded the Account Kit script in the front-end:

<script src="https://sdk.accountkit.com/en_US/sdk.js"></script>

<script>		
	AccountKit_OnInteractive = function() {
		AccountKit.init({
			appId: '{{ FACEBOOK_APP_ID }}', 
			state: '{{ CSRF_TOKEN }}', 
			version: 'v1.1',
			fbAppEventsEnabled: true,
		});
	};
</script>

(in a first moment, when developing, you can put anything in the csrf token to make the flow work first, then you may return here and handle the csrf token)

3) In a button press event from the user I call the javascript SDK:

AccountKit.login(
      'PHONE', 
      {countryCode: countryCode, phoneNumber: phoneNumber}, // will use default values if not specified
      loginCallback
    );

4) The loginCallback function calls my backend api in case of success, or shows an error otherwise:

function loginCallback(response) {
	if (response.status === "PARTIALLY_AUTHENTICATED") {
		var code = response.code;
		var csrf = response.state;
		callbackSuccess(code, csrf);
	}
	else if (response.status === "NOT_AUTHENTICATED") {
		callbackError("NOT_AUTHENTICATED");
	}
	else if (response.status === "BAD_PARAMS") {
		callbackError("BAD_PARAMS");
	}
}

5) Then in the backend I call the Account Kit endpoint https://graph.accountkit.com/v1.1/access_token passing the code to retrieve the access token, and then I call https://graph.accountkit.com/v1.1/me passing the access token to retrieve the phone number (phone.number), but first I make sure that it was called using my application Id (created in the 1st step).

Click to see the java code that I use (for reference)
public static String retrievePhoneData(String code) throws HTTPException, NotAllowedException {
	String appAccessToken = Arrays.asList(
		"AA", FACEBOOK_APP_ID, ACCOUNT_KIT_APP_SECRET
	).stream().collect(Collectors.joining("|"));
	
	Map<String, String> params = new HashMap<>();
	params.put("grant_type", "authorization_code");
	params.put("code", code);
	params.put("access_token", appAccessToken);
	
	SimpleHttpClientRequest requestToken = new SimpleHttpClientRequest();
	requestToken.setMethod(HTTPMethod.GET);
	requestToken.setUrl(TOKEN_EXCHANGE_BASE_URL);
	requestToken.setParametros(params);
	
	SimpleHttpClientResponse responseToken = URIUtils.getResponseObjectFromRequest(requestToken);
	
	int statusCodeToken = responseToken.getStatusCode();
	
	if ((statusCodeToken < 200) || (statusCodeToken > 299)) {
		throw new HTTPException(requestToken, responseToken);
	}
	
	String responseStrToken = responseToken.getResponse();
	
	Mapper mapperToken = StringUtil.getMapperFromJSON(responseStrToken);
	
	String accessToken = mapperToken.getAsString("access_token");
	
	SimpleHttpClientRequest requestMain = new SimpleHttpClientRequest();
	requestMain.setMethod(HTTPMethod.GET);
	requestMain.setUrl(ME_ENDPOINT_BASE_URL + "?access_token=" + accessToken);
	
	SimpleHttpClientResponse responseMain = URIUtils.getResponseObjectFromRequest(requestMain);
	
	int statusCodeMain = responseMain.getStatusCode();
	
	if ((statusCodeMain < 200) || (statusCodeMain > 299)) {
		throw new HTTPException(requestMain, responseMain);
	}
	
	String responseStrMain = responseMain.getResponse();
	
	Mapper mapperMain = StringUtil.getMapperFromJSON(responseStrMain);
	
	String appId = mapperMain.getAsString("application.id");
	
	if (!FACEBOOK_APP_ID.equals(appId)) {
		throw new NotAllowedException();
	}
	
	String phoneNumber = mapperMain.getAsString("phone.number");
	
	return phoneNumber;
}

I haven’t seen any videos, just followed the steps that is explained here:

https://developers.facebook.com/docs/accountkit/webjs

(the main change was that it’s in nodejs, and I used java, but it was pretty straightforward, after all it’s just api calls in the backend)

If you use the javascript flow (including the script that loads the sdk and so on), I don’t think so. But like I said, I haven’t implemented it in a Discourse site, so I don’t know the exact requirements to create a plugin that supports Account Kit.