anoncgain
anoncgain

Reputation: 425

How to show Oauth Consent screen in flutter

I am trying to user gmail api. Google is asking me to make a video with demo of Oauth consent screen. While searching in the internet I have found solutions for web and native android android. The docs of flutter packages googleapi and googleapi_auth were not very helful. If anyone has already implemented any suggestions would be helpful.

Upvotes: 0

Views: 563

Answers (1)

Jalakam Kiran
Jalakam Kiran

Reputation: 197

It's probably too late but here is the code for

'    clientViaUserConsent(_clientid, _scopes, userPrompt)
    .then((AuthClient client) {
  //your code to authenticate any of your google platform

}

Here is the userPrompt function

void userPrompt(String url) async {
if (await canLaunch(url)) {
  print("Launching url");
  launch(url);
} else {
  print("unable to launch the url");
}}

So whenever the clientviauserprompt is called the prompt function will launch the url to the default browser for the user consent. You have to use urllauncher dependency for this.

Upvotes: 1

Related Questions