简体   繁体   中英

How to get access token for Alexa Smapis in Flutter?

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>

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

Adding

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM