Reputation: 3
Is there any way to do get access token for Alexa Smapis in Flutter without the following command?
ask util generate-lwa-tokens --no-browser <scopes>
Upvotes: 0
Views: 881
Reputation: 1957
Yes. The ASK CLI function you're asking about is a convenience utility. You can always set up your own Login with Amazon client in Flutter to get the tokens. Here are the details.
https://developer.amazon.com/en-US/docs/alexa/smapi/get-access-token-smapi.html
Looks like someone created a package to help you use Login with Amazon in Flutter too (caveat: haven't tried it myself)
https://pub.dev/packages/flutter_lwa
The example in your follow-up question is a scope. It sets the scope of the permissions for the customer to grant to your app.
The example for that Flutter library uses the following to set the scope.
import 'package:flutter_lwa/lwa.dart';
LoginWithAmazon _loginWithAmazon = LoginWithAmazon(
scopes: <Scope>[ProfileScope.profile(), ProfileScope.postalCode()],
);
Those variables are defined here in that package. https://github.com/ayvazj/flutter_lwa/blob/master/lib/scope.dart
Hopefully you can figure it out from there. I know about Login with Amazon and how its token requests work, but very little about Flutter.
Upvotes: 1