-
-
Save alexastrum/ae009e6add41f08d85c662716e934e2f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
void initState() { | |
deepLinkSubscription = getLinksStream().listen((String link) { | |
loginWithGitHub(link); | |
}, cancelOnError: true); | |
super.initState(); | |
} | |
//... | |
void loginWithGitHub(String link) async { | |
//Step 4 | |
final response = await http.post( | |
"https://identitytoolkit.googleapis.com/v1/accounts:signInWithIdp?key=" + FIREBASE_API_KEY, | |
headers: { | |
"Content-Type": "application/json", | |
"Accept": "application/json" | |
}, | |
body: "{\"requestUri\":\"" + link | |
+ "\"}", | |
); | |
final AuthCredential credential = GithubAuthProvider.credential( | |
json.decode(response.body)['oauthAccessToken'], | |
); | |
//... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment