I think I found a very good solution, but that is probably not how the Google resolution screen works.
In Authenticator, you get a calling package that cannot be faked, because the AccountManager checks the UID / PID of the application. You use the calling package as part of the token type, as well as the application installation date (optionally found using the package manager), so each application token will be cached separately.
If the token type does not contain the package name as the calling package, the token will not be returned.
For each type of authorization token, you also check the client's secret regarding the client key. After that, you will only return the "Allow access" intent if this is the first time the client requests a key for each account for each custom type of account.
Please note that if you want to use the whitelisted application, you can also do this based on the type of token.
source share