Skip to content

Instantly share code, notes, and snippets.

@stevehobbsdev
Created March 15, 2022 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevehobbsdev/0edc1f1614563397fda69f6f6e6f9d29 to your computer and use it in GitHub Desktop.
Save stevehobbsdev/0edc1f1614563397fda69f6f6e6f9d29 to your computer and use it in GitHub Desktop.
Dart: Api 3
// SPA JS-like
// Tries to implement pattern like: https://dart.academy/creational-design-patterns-for-dart-and-flutter-builder/
void main() {
final client = Auth0WebClient(
domain: 'test', clientId: 'test', audience: 'test', issuer: 'test');
client.loginWithRedirect();
}
class Auth0WebClient {
final String domain;
final String clientId;
final String? audience;
final String? issuer;
Auth0WebClient(
{required this.domain,
required this.clientId,
this.issuer,
this.audience});
loginWithRedirect() {
// .. //
}
getAccessToken() {
// .. //
}
logout() {
// .. //
}
Auth0WebClient copyWith({String? audience, String? issuer}) {
return Auth0WebClient(
domain: domain,
clientId: clientId,
audience: audience ?? this.audience,
issuer: issuer ?? this.issuer);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment